diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index f3fff3ef..20606b67 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -9,6 +9,7 @@ on: - v2 - v3 - v4 + - v5 - master jobs: test: diff --git a/CHANGELOG.md b/CHANGELOG.md index bdfb1579..7fb54da7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # EDGEGRID GOLANG RELEASE NOTES +## 6.0.0 (May 23, 2023) + +### BREAKING CHANGES: + +* APPSEC + * Update malware policy `ContentTypes` to include `EncodedContentAttributes`. + * Malware policy's `ContentTypes` is reported as part of an individual policy but is no longer included in the bulk report of all policies. + +* CLOUDLETS + * `ActivatePolicyVersion` also returns list of triggerred activations + +* PAPI + * Fix property variables fields with empty and null values are ignored + * Remove `ProductID` field from `GetEdgeHostname` response + +### BUG FIXES: +* APPSEC + * Omit `clientIdentifier` and `additionalMatchOptions` in `GetExportConfigurationResponse` when empty + ## 5.0.0 (March 28, 2023) ### FEATURES/ENHANCEMENTS: diff --git a/README.md b/README.md index bfcc84e7..5fe71ef3 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# Akamai OPEN EdgeGrid for GoLang v5 +# Akamai OPEN EdgeGrid for GoLang v6 ![Build Status](https://github.com/akamai/akamaiOPEN-edgegrid-golang/actions/workflows/checks.yml/badge.svg) -[![Go Report Card](https://goreportcard.com/badge/github.com/akamai/akamaiOPEN-edgegrid-golang/v5)](https://goreportcard.com/report/github.com/akamai/akamaiOPEN-edgegrid-golang/v5) +[![Go Report Card](https://goreportcard.com/badge/github.com/akamai/AkamaiOPEN-edgegrid-golang/v6)](https://goreportcard.com/report/github.com/akamai/AkamaiOPEN-edgegrid-golang/v6) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/akamai/akamaiOPEN-edgegrid-golang) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) -[![GoDoc](https://pkg.go.dev/badge/github.com/akamai/akamaiOPEN-edgegrid-golang?utm_source=godoc)](https://pkg.go.dev/github.com/akamai/AkamaiOPEN-edgegrid-golang/v5) +[![GoDoc](https://pkg.go.dev/badge/github.com/akamai/akamaiOPEN-edgegrid-golang?utm_source=godoc)](https://pkg.go.dev/github.com/akamai/AkamaiOPEN-edgegrid-golang/v6) This module is presently in active development and provides Akamai REST API support for the Akamai Terraform Provider. @@ -12,7 +12,7 @@ This module is presently in active development and provides Akamai REST API supp This module is not backward compatible with the version `v1`. -Originally branch `master` was representing version `v1`. Now it is representing the latest version `v5` and +Originally branch `master` was representing version `v1`. Now it is representing the latest version `v6` and version `v1` was moved to dedicated `v1` branch. @@ -22,7 +22,7 @@ The packages of library can be imported alongside the `v1` library versions with ``` import ( - "github.com/akamai/AkamaiOPEN-edgegrid-golang/papi-v1" - papiv5 "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/papi" + papiv1 "github.com/akamai/AkamaiOPEN-edgegrid-golang/papi-v1" + papi "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/papi" ) ``` diff --git a/go.mod b/go.mod index 47d2e638..57c81b24 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/akamai/AkamaiOPEN-edgegrid-golang/v5 +module github.com/akamai/AkamaiOPEN-edgegrid-golang/v6 go 1.18 diff --git a/pkg/appsec/activations_test.go b/pkg/appsec/activations_test.go index b72df0bb..48cba12e 100644 --- a/pkg/appsec/activations_test.go +++ b/pkg/appsec/activations_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/appsec/advanced_settings_attack_payload_logging.go b/pkg/appsec/advanced_settings_attack_payload_logging.go index 416afcb8..93cfe1c9 100644 --- a/pkg/appsec/advanced_settings_attack_payload_logging.go +++ b/pkg/appsec/advanced_settings_attack_payload_logging.go @@ -6,7 +6,7 @@ import ( "fmt" "net/http" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/appsec/advanced_settings_attack_payload_logging_test.go b/pkg/appsec/advanced_settings_attack_payload_logging_test.go index 244a458a..c161d98e 100644 --- a/pkg/appsec/advanced_settings_attack_payload_logging_test.go +++ b/pkg/appsec/advanced_settings_attack_payload_logging_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/appsec/advanced_settings_evasive_path_match_test.go b/pkg/appsec/advanced_settings_evasive_path_match_test.go index d2f72ff0..a1fd6ce3 100644 --- a/pkg/appsec/advanced_settings_evasive_path_match_test.go +++ b/pkg/appsec/advanced_settings_evasive_path_match_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -126,12 +126,12 @@ func TestAppSec_GetAdvancedSettingsEvasivePathmatch(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching AdvancedSettingsEvasivePathMatch" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching AdvancedSettingsEvasivePathMatch" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/advanced-settings/evasive-path-match", withError: &Error{ Type: "internal_error", @@ -205,12 +205,12 @@ func TestAppSec_UpdateAdvancedSettingsEvasivePathMatch(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating AdvancedSettingsEvasivePathMatch" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating AdvancedSettingsEvasivePathMatch" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/advanced-settings/evasive-path-match", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/advanced_settings_logging_test.go b/pkg/appsec/advanced_settings_logging_test.go index b658c16a..39f2d036 100644 --- a/pkg/appsec/advanced_settings_logging_test.go +++ b/pkg/appsec/advanced_settings_logging_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -126,12 +126,12 @@ func TestAppSec_GetAdvancedSettingsLogging(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching AdvancedSettingsLogging" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching AdvancedSettingsLogging" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/advanced-settings/logging", withError: &Error{ Type: "internal_error", @@ -205,12 +205,12 @@ func TestAppSec_UpdateAdvancedSettingsLogging(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating AdvancedSettingsLogging" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating AdvancedSettingsLogging" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/advanced-settings/logging", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/advanced_settings_pragma_test.go b/pkg/appsec/advanced_settings_pragma_test.go index b27667e2..2226d1e0 100644 --- a/pkg/appsec/advanced_settings_pragma_test.go +++ b/pkg/appsec/advanced_settings_pragma_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -126,12 +126,12 @@ func TestAppSec_GetAdvancedSettingsPrama(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching AdvancedSettingsPragma" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching AdvancedSettingsPragma" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/advanced-settings/pragma-header", withError: &Error{ Type: "internal_error", @@ -205,7 +205,7 @@ func TestAppSec_UpdateAdvancedSettingsPragma(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (`{"type": "internal_error","title": "Internal Server Error","detail": "Error creating AdvancedSettingsPragma"}`), + responseBody: `{"type": "internal_error","title": "Internal Server Error","detail": "Error creating AdvancedSettingsPragma"}`, expectedPath: "/appsec/v1/configs/43253/versions/15/advanced-settings/pragma-header", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/advanced_settings_prefetch_test.go b/pkg/appsec/advanced_settings_prefetch_test.go index d897dd94..9b668d04 100644 --- a/pkg/appsec/advanced_settings_prefetch_test.go +++ b/pkg/appsec/advanced_settings_prefetch_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -126,12 +126,12 @@ func TestAppSec_GetAdvancedSettingsPrefetch(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching AdvancedSettingsPrefetch" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching AdvancedSettingsPrefetch" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/advanced-settings/prefetch", withError: &Error{ Type: "internal_error", @@ -205,12 +205,12 @@ func TestAppSec_UpdateAdvancedSettingsPrefetch(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating AdvancedSettingsPrefetch" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating AdvancedSettingsPrefetch" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/advanced-settings/prefetch", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/advanced_settings_request_body.go b/pkg/appsec/advanced_settings_request_body.go index e99f1acf..685ea7f1 100644 --- a/pkg/appsec/advanced_settings_request_body.go +++ b/pkg/appsec/advanced_settings_request_body.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/appsec/advanced_settings_request_body_test.go b/pkg/appsec/advanced_settings_request_body_test.go index 74517501..9e97efd9 100644 --- a/pkg/appsec/advanced_settings_request_body_test.go +++ b/pkg/appsec/advanced_settings_request_body_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/appsec/api_constraints_protection_test.go b/pkg/appsec/api_constraints_protection_test.go index 7f7cc271..37956137 100644 --- a/pkg/appsec/api_constraints_protection_test.go +++ b/pkg/appsec/api_constraints_protection_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -48,12 +48,12 @@ func TestAppSec_GetAPIConstraintsProtection(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/protections", withError: &Error{ Type: "internal_error", @@ -129,12 +129,12 @@ func TestAppSec_UpdateAPIConstraintsProtection(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/protections", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/api_endpoints_test.go b/pkg/appsec/api_endpoints_test.go index c4a3417c..823b2d9b 100644 --- a/pkg/appsec/api_endpoints_test.go +++ b/pkg/appsec/api_endpoints_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -126,12 +126,12 @@ func TestAppSec_GetApiEndpoints(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching ApiEndpoints" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching ApiEndpoints" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/api-endpoints", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/api_hostname_coverage_match_targets_test.go b/pkg/appsec/api_hostname_coverage_match_targets_test.go index 634b4b9b..1012ed65 100644 --- a/pkg/appsec/api_hostname_coverage_match_targets_test.go +++ b/pkg/appsec/api_hostname_coverage_match_targets_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -130,12 +130,12 @@ func TestAppSec_GetApiHostnameCoverageMatchTargets(t *testing.T) { Hostname: "www.example.com", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching ApiHostnameCoverageMatchTargets" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching ApiHostnameCoverageMatchTargets" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/hostname-coverage/match-targets?hostname=www.example.com", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/api_hostname_coverage_overlapping_test.go b/pkg/appsec/api_hostname_coverage_overlapping_test.go index db62a51d..3c19cdd8 100644 --- a/pkg/appsec/api_hostname_coverage_overlapping_test.go +++ b/pkg/appsec/api_hostname_coverage_overlapping_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -128,12 +128,12 @@ func TestAppSec_GetApiHostnameCoverageOverlapping(t *testing.T) { Hostname: "www.example.com", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching ApiHostnameCoverageOverlapping" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching ApiHostnameCoverageOverlapping" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/hostname-coverage/overlapping?hostname=www.example.com", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/api_hostname_coverage_test.go b/pkg/appsec/api_hostname_coverage_test.go index 3c7ac1e6..b5514c30 100644 --- a/pkg/appsec/api_hostname_coverage_test.go +++ b/pkg/appsec/api_hostname_coverage_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -126,12 +126,12 @@ func TestAppSec_GetApiHostnameCoverage(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching ApiHostnameCoverage" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching ApiHostnameCoverage" + }`, expectedPath: "/appsec/v1/hostname-coverage", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/api_request_constraints_test.go b/pkg/appsec/api_request_constraints_test.go index 895fad41..a051b3b3 100644 --- a/pkg/appsec/api_request_constraints_test.go +++ b/pkg/appsec/api_request_constraints_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -130,12 +130,12 @@ func TestAppSec_GetApiRequestConstraints(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching ApiRequestConstraints" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching ApiRequestConstraints" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/api-request-constraints", withError: &Error{ Type: "internal_error", @@ -211,12 +211,12 @@ func TestAppSec_UpdateApiRequestConstraints(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating ApiRequestConstraints" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating ApiRequestConstraints" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/api-request-constraints", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/appsec.go b/pkg/appsec/appsec.go index 95a3380c..830f21e3 100644 --- a/pkg/appsec/appsec.go +++ b/pkg/appsec/appsec.go @@ -4,7 +4,7 @@ package appsec import ( "errors" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" ) var ( diff --git a/pkg/appsec/appsec_test.go b/pkg/appsec/appsec_test.go index 505935f8..4336bc73 100644 --- a/pkg/appsec/appsec_test.go +++ b/pkg/appsec/appsec_test.go @@ -12,8 +12,8 @@ import ( "net/url" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegrid" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegrid" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/appsec/attack_group_test.go b/pkg/appsec/attack_group_test.go index 069cb74d..03a074c3 100644 --- a/pkg/appsec/attack_group_test.go +++ b/pkg/appsec/attack_group_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -132,12 +132,12 @@ func TestAppSec_GetAttackGroup(t *testing.T) { Group: "SQL", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/attack-groups/SQL?includeConditionException=true", withError: &Error{ Type: "internal_error", @@ -215,12 +215,12 @@ func TestAppSec_UpdateAttackGroup(t *testing.T) { Group: "SQL", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/attack-groups/SQL/action-condition-exception", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/configuration_clone_test.go b/pkg/appsec/configuration_clone_test.go index 1cdf7f2e..a4e3fe4c 100644 --- a/pkg/appsec/configuration_clone_test.go +++ b/pkg/appsec/configuration_clone_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -126,12 +126,12 @@ func TestAppSec_GetConfigurationClone(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching ConfigurationClone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching ConfigurationClone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15", withError: &Error{ Type: "internal_error", @@ -209,12 +209,12 @@ func TestAppSec_CreateConfigurationClone(t *testing.T) { }{ConfigID: 42345, Version: 7}}, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating ConfigurationClone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating ConfigurationClone" + }`, expectedPath: "/appsec/v1/configs/", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/configuration_test.go b/pkg/appsec/configuration_test.go index abb338c2..256d312f 100644 --- a/pkg/appsec/configuration_test.go +++ b/pkg/appsec/configuration_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/appsec/configuration_version_clone_test.go b/pkg/appsec/configuration_version_clone_test.go index a0858f8b..1987fbd2 100644 --- a/pkg/appsec/configuration_version_clone_test.go +++ b/pkg/appsec/configuration_version_clone_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -126,12 +126,12 @@ func TestAppSec_GetConfigurationVersionClone(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15", withError: &Error{ Type: "internal_error", @@ -208,12 +208,12 @@ func TestAppSec_CreateConfigurationVersionClone(t *testing.T) { CreateFromVersion: 3, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating ConfigurationVersionClone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating ConfigurationVersionClone" + }`, expectedPath: "/appsec/v1/configs/43253/versions", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/configuration_version_test.go b/pkg/appsec/configuration_version_test.go index bfd44af5..6825079e 100644 --- a/pkg/appsec/configuration_version_test.go +++ b/pkg/appsec/configuration_version_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/appsec/custom_deny_test.go b/pkg/appsec/custom_deny_test.go index 5d2f5737..375f05a4 100644 --- a/pkg/appsec/custom_deny_test.go +++ b/pkg/appsec/custom_deny_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -128,12 +128,12 @@ func TestAppSec_GetCustomDeny(t *testing.T) { ID: "622919", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching CustomDeny" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching CustomDeny" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/custom-deny/622919", withError: &Error{ Type: "internal_error", @@ -209,12 +209,12 @@ func TestAppSec_CreateCustomDeny(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating CustomDeny" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating CustomDeny" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/custom-deny", withError: &Error{ Type: "internal_error", @@ -294,12 +294,12 @@ func TestAppSec_UpdateCustomDeny(t *testing.T) { ID: "deny_custom_622918", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating CustomDeny" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating CustomDeny" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/custom-deny/deny_custom_622918", withError: &Error{ Type: "internal_error", @@ -380,12 +380,12 @@ func TestAppSec_RemoveCustomDeny(t *testing.T) { ID: "deny_custom_622918", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error deleting CustomDeny" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error deleting CustomDeny" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/custom-deny/deny_custom_622918", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/custom_rule_action_test.go b/pkg/appsec/custom_rule_action_test.go index 32336aba..cdb8b06f 100644 --- a/pkg/appsec/custom_rule_action_test.go +++ b/pkg/appsec/custom_rule_action_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -138,12 +138,12 @@ func TestAppSec_GetCustomRuleAction(t *testing.T) { RuleID: 60036378, }, responseStatus: http.StatusInternalServerError, - responseBody: (` - { - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" - }`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/custom-rules", withError: &Error{ Type: "internal_error", @@ -221,12 +221,12 @@ func TestAppSec_UpdateCustomRuleAction(t *testing.T) { RuleID: 12345, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/custom-rules/12345", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/custom_rule_test.go b/pkg/appsec/custom_rule_test.go index 6b6e246e..b40db027 100644 --- a/pkg/appsec/custom_rule_test.go +++ b/pkg/appsec/custom_rule_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -124,12 +124,12 @@ func TestAppSec_GetCustomRule(t *testing.T) { ID: 60039625, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/custom-rules/60039625", withError: &Error{ Type: "internal_error", @@ -203,12 +203,12 @@ func TestAppSec_CreateCustomRule(t *testing.T) { ConfigID: 43253, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating domain" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating domain" + }`, expectedPath: "/appsec/v1/configs/43253/custom-rules", withError: &Error{ Type: "internal_error", @@ -286,12 +286,12 @@ func TestAppSec_UpdateCustomRule(t *testing.T) { ID: 60039625, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/custom-rules/%d", withError: &Error{ Type: "internal_error", @@ -370,12 +370,12 @@ func TestAppSec_RemoveCustomRule(t *testing.T) { ID: 60039625, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error deleting match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error deleting match target" + }`, expectedPath: "/appsec/v1/configs/43253/custom-rules/%d", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/errors_test.go b/pkg/appsec/errors_test.go index 9b2c7202..43d9977d 100644 --- a/pkg/appsec/errors_test.go +++ b/pkg/appsec/errors_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/require" "github.com/tj/assert" ) diff --git a/pkg/appsec/eval_group_test.go b/pkg/appsec/eval_group_test.go index 18b23578..db59a568 100644 --- a/pkg/appsec/eval_group_test.go +++ b/pkg/appsec/eval_group_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -132,12 +132,12 @@ func TestAppSec_GetEvalGroup(t *testing.T) { Group: "SQL", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/eval-groups/SQL?includeConditionException=true", withError: &Error{ Type: "internal_error", @@ -215,12 +215,12 @@ func TestAppSec_UpdateEvalGroup(t *testing.T) { Group: "SQL", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/eval-groups/SQL/action-condition-exception", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/eval_penalty_box_test.go b/pkg/appsec/eval_penalty_box_test.go index fb3d63f1..8c855acf 100644 --- a/pkg/appsec/eval_penalty_box_test.go +++ b/pkg/appsec/eval_penalty_box_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -48,12 +48,12 @@ func TestAppSec_GetEvalPenaltyBox(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/eval-penalty-box", withError: &Error{ Type: "internal_error", @@ -133,12 +133,12 @@ func TestAppSec_UpdateEvalPenaltyBox(t *testing.T) { Action: string(ActionTypeDeny), }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/eval-penalty-box", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/eval_rule_test.go b/pkg/appsec/eval_rule_test.go index aaa998ef..31cbb930 100644 --- a/pkg/appsec/eval_rule_test.go +++ b/pkg/appsec/eval_rule_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -132,12 +132,12 @@ func TestAppSec_GetEvalRule(t *testing.T) { RuleID: 12345, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/eval-rules/12345?includeConditionException=true", withError: &Error{ Type: "internal_error", @@ -215,12 +215,12 @@ func TestAppSec_UpdateEvalRule(t *testing.T) { RuleID: 12345, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/eval-rules/12345/action-condition-exceptions", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/eval_test.go b/pkg/appsec/eval_test.go index a2461b43..556f00c0 100644 --- a/pkg/appsec/eval_test.go +++ b/pkg/appsec/eval_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -130,12 +130,12 @@ func TestAppSec_GetEval(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/mode", withError: &Error{ Type: "internal_error", @@ -211,12 +211,12 @@ func TestAppSec_UpdateEval(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/eval", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/export_configuration.go b/pkg/appsec/export_configuration.go index 6cd58b10..0d475f55 100644 --- a/pkg/appsec/export_configuration.go +++ b/pkg/appsec/export_configuration.go @@ -68,11 +68,11 @@ type ( PositiveMatch bool `json:"positiveMatch"` Type string `json:"type"` Values []string `json:"values"` - } `json:"additionalMatchOptions"` + } `json:"additionalMatchOptions,omitempty"` AllTraffic bool `json:"allTraffic,omitempty"` AverageThreshold int `json:"averageThreshold"` BurstThreshold int `json:"burstThreshold"` - ClientIdentifier string `json:"clientIdentifier"` + ClientIdentifier string `json:"clientIdentifier,omitempty"` CreateDate time.Time `json:"-"` Description string `json:"description,omitempty"` FileExtensions *RatePolicyFileExtensions `json:"fileExtensions,omitempty"` diff --git a/pkg/appsec/export_configuration_test.go b/pkg/appsec/export_configuration_test.go index 343a6bff..efd2d06b 100644 --- a/pkg/appsec/export_configuration_test.go +++ b/pkg/appsec/export_configuration_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/appsec/failover_hostnames_test.go b/pkg/appsec/failover_hostnames_test.go index 6fa4bcf3..ecfb5b09 100644 --- a/pkg/appsec/failover_hostnames_test.go +++ b/pkg/appsec/failover_hostnames_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -122,12 +122,12 @@ func TestAppSec_GetFailoverHostnames(t *testing.T) { ConfigID: 43253, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/failover-hostnames", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/ip_geo_protection_test.go b/pkg/appsec/ip_geo_protection_test.go index dbdaf2d4..8a413c01 100644 --- a/pkg/appsec/ip_geo_protection_test.go +++ b/pkg/appsec/ip_geo_protection_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -130,12 +130,12 @@ func TestAppSec_GetIPGeoProtection(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/protections", withError: &Error{ Type: "internal_error", @@ -211,12 +211,12 @@ func TestAppSec_UpdateIPGeoProtection(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/protections", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/ip_geo_test.go b/pkg/appsec/ip_geo_test.go index a28cd1e3..f46748e1 100644 --- a/pkg/appsec/ip_geo_test.go +++ b/pkg/appsec/ip_geo_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -48,12 +48,12 @@ func TestAppSec_GetIPGeo(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/ip-geo-firewall", withError: &Error{ Type: "internal_error", @@ -129,12 +129,12 @@ func TestAppSec_UpdateIPGeo(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/ip-geo-firewall", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/malware_policy.go b/pkg/appsec/malware_policy.go index 0bad6a89..c687ca8a 100644 --- a/pkg/appsec/malware_policy.go +++ b/pkg/appsec/malware_policy.go @@ -39,15 +39,27 @@ type ( // MalwarePolicyBody describes a malware policy. MalwarePolicyBody struct { - MalwarePolicyID int `json:"id"` - Name string `json:"name"` - Description string `json:"description,omitempty"` - Hostnames []string `json:"hostnames"` - Paths []string `json:"paths"` - ContentTypes []string `json:"contentTypes"` - LogFilename bool `json:"logFilename,omitempty"` - AllowListID string `json:"allowListId,omitempty"` - BlockListID string `json:"blockListId,omitempty"` + MalwarePolicyID int `json:"id"` + Name string `json:"name"` + Description string `json:"description,omitempty"` + Hostnames []string `json:"hostnames"` + Paths []string `json:"paths"` + ContentTypes []ContentType `json:"contentTypes,omitempty"` + LogFilename bool `json:"logFilename,omitempty"` + AllowListID string `json:"allowListId,omitempty"` + BlockListID string `json:"blockListId,omitempty"` + } + + // ContentType describes a content type and its optional encoded content attributes. + ContentType struct { + Name string `json:"name"` + EncodedContentAttributes []EncodedContentAttribute `json:"encodedContentAttributes,omitempty"` + } + + // EncodedContentAttribute describes a JSON path to a property with encoded content. + EncodedContentAttribute struct { + Path string `json:"path"` + Encoding []string `json:"encoding"` } // CreateMalwarePolicyRequest is used to create a malware policy. @@ -59,15 +71,15 @@ type ( // MalwarePolicyResponse is returned from a call to CreateMalwarePolicy MalwarePolicyResponse struct { - MalwarePolicyID int `json:"id"` - Name string `json:"name"` - Description string `json:"description,omitempty"` - Hostnames []string `json:"hostnames"` - Paths []string `json:"paths"` - ContentTypes []string `json:"contentTypes"` - LogFilename bool `json:"logFilename,omitempty"` - AllowListID string `json:"allowListId,omitempty"` - BlockListID string `json:"blockListId,omitempty"` + MalwarePolicyID int `json:"id"` + Name string `json:"name"` + Description string `json:"description,omitempty"` + Hostnames []string `json:"hostnames"` + Paths []string `json:"paths"` + ContentTypes []ContentType `json:"contentTypes,omitempty"` + LogFilename bool `json:"logFilename,omitempty"` + AllowListID string `json:"allowListId,omitempty"` + BlockListID string `json:"blockListId,omitempty"` } // GetMalwarePolicyRequest is used to retrieve an existing malware policy. diff --git a/pkg/appsec/malware_policy_action_test.go b/pkg/appsec/malware_policy_action_test.go index 4ee471ff..4ac9a81f 100644 --- a/pkg/appsec/malware_policy_action_test.go +++ b/pkg/appsec/malware_policy_action_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -143,12 +143,12 @@ func TestAppSec_UpdateMalwarePolicyAction(t *testing.T) { UnscannedAction: "deny", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/malware-policies/134644", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/malware_policy_test.go b/pkg/appsec/malware_policy_test.go index 71ba28e7..fed80af8 100644 --- a/pkg/appsec/malware_policy_test.go +++ b/pkg/appsec/malware_policy_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -46,12 +46,12 @@ func TestAppSec_GetMalwarePolicy(t *testing.T) { MalwarePolicyID: 134644, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/malware-policies/134644", withError: &Error{ Type: "internal_error", @@ -206,12 +206,12 @@ func TestAppSec_CreateMalwarePolicy(t *testing.T) { Policy: &req, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating domain" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating domain" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/malware-policies", withError: &Error{ Type: "internal_error", @@ -294,12 +294,12 @@ func TestAppSec_UpdateMalwarePolicy(t *testing.T) { Policy: &req, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/malware-policies/134644", withError: &Error{ Type: "internal_error", @@ -365,12 +365,12 @@ func TestAppSec_RemoveMalwarePolicy(t *testing.T) { MalwarePolicyID: 134644, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error deleting match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error deleting match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/malware-policies/134644", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/malware_protection_test.go b/pkg/appsec/malware_protection_test.go index ea672555..7cd35ca8 100644 --- a/pkg/appsec/malware_protection_test.go +++ b/pkg/appsec/malware_protection_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -48,12 +48,12 @@ func TestAppSec_GetMalwareProtection(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/protections", withError: &Error{ Type: "internal_error", @@ -129,12 +129,12 @@ func TestAppSec_UpdateMalwareProtection(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/protections", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/match_target_sequence_test.go b/pkg/appsec/match_target_sequence_test.go index d4ec980c..fc07424e 100644 --- a/pkg/appsec/match_target_sequence_test.go +++ b/pkg/appsec/match_target_sequence_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -130,12 +130,12 @@ func TestAppSec_GetMatchTargetSequence(t *testing.T) { Type: "website", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/match-targets/sequence?type=website", withError: &Error{ Type: "internal_error", @@ -211,12 +211,12 @@ func TestAppSec_UpdateMatchTargetSequence(t *testing.T) { Type: "website", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/match-targets/%d", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/match_target_test.go b/pkg/appsec/match_target_test.go index 05963c8b..2a851b11 100644 --- a/pkg/appsec/match_target_test.go +++ b/pkg/appsec/match_target_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -128,12 +128,12 @@ func TestAppSec_GetMatchTarget(t *testing.T) { TargetID: 3008967, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/match-targets/3008967?includeChildObjectName=true", withError: &Error{ Type: "internal_error", @@ -209,12 +209,12 @@ func TestAppSec_CreateMatchTarget(t *testing.T) { ConfigVersion: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating domain" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating domain" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/match-targets", withError: &Error{ Type: "internal_error", @@ -294,12 +294,12 @@ func TestAppSec_UpdateMatchTarget(t *testing.T) { TargetID: 3008967, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/match-targets/3008967", withError: &Error{ Type: "internal_error", @@ -380,12 +380,12 @@ func TestAppSec_RemoveMatchTarget(t *testing.T) { TargetID: 3008967, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error deleting match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error deleting match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/match-targets/3008967", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/penalty_box_test.go b/pkg/appsec/penalty_box_test.go index 72caffff..97b56a0d 100644 --- a/pkg/appsec/penalty_box_test.go +++ b/pkg/appsec/penalty_box_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -130,12 +130,12 @@ func TestAppSec_GetPenaltyBox(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/penalty-box", withError: &Error{ Type: "internal_error", @@ -215,12 +215,12 @@ func TestAppSec_UpdatePenaltyBox(t *testing.T) { Action: string(ActionTypeDeny), }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/penalty-box", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/rate_policy_action_test.go b/pkg/appsec/rate_policy_action_test.go index bbc0a82f..8050ebf8 100644 --- a/pkg/appsec/rate_policy_action_test.go +++ b/pkg/appsec/rate_policy_action_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -130,12 +130,12 @@ func TestAppSec_GetRatePolicyAction(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/rate-policies", withError: &Error{ Type: "internal_error", @@ -213,12 +213,12 @@ func TestAppSec_UpdateRatePolicyAction(t *testing.T) { RatePolicyID: 134644, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/rate-policies/134644", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/rate_policy_test.go b/pkg/appsec/rate_policy_test.go index 6d55e6bd..24b9d823 100644 --- a/pkg/appsec/rate_policy_test.go +++ b/pkg/appsec/rate_policy_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -128,12 +128,12 @@ func TestAppSec_GetRatePolicy(t *testing.T) { RatePolicyID: 134644, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/rate-policies/134644", withError: &Error{ Type: "internal_error", @@ -209,12 +209,12 @@ func TestAppSec_CreateRatePolicy(t *testing.T) { ConfigVersion: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating domain" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating domain" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/rate-policies", withError: &Error{ Type: "internal_error", @@ -294,12 +294,12 @@ func TestAppSec_CreateRatePolicy_NegativeMatch(t *testing.T) { ConfigVersion: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating domain" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating domain" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/rate-policies", withError: &Error{ Type: "internal_error", @@ -379,12 +379,12 @@ func TestAppSec_UpdateRatePolicy(t *testing.T) { RatePolicyID: 134644, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/rate-policies/134644", withError: &Error{ Type: "internal_error", @@ -465,12 +465,12 @@ func TestAppSec_RemoveRatePolicy(t *testing.T) { RatePolicyID: 134644, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error deleting match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error deleting match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/rate-policies/134644", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/rate_protection_test.go b/pkg/appsec/rate_protection_test.go index 70894a7c..9d8a8d49 100644 --- a/pkg/appsec/rate_protection_test.go +++ b/pkg/appsec/rate_protection_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -130,12 +130,12 @@ func TestAppSec_GetRateProtection(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/protections", withError: &Error{ Type: "internal_error", @@ -211,12 +211,12 @@ func TestAppSec_UpdateRateProtection(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/protections", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/reputation_analysis_test.go b/pkg/appsec/reputation_analysis_test.go index 274f9a1a..babb266e 100644 --- a/pkg/appsec/reputation_analysis_test.go +++ b/pkg/appsec/reputation_analysis_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -130,12 +130,12 @@ func TestAppSec_GetReputationAnalysis(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching ReputationAnalysis" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching ReputationAnalysis" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/reputation-analysis", withError: &Error{ Type: "internal_error", @@ -211,12 +211,12 @@ func TestAppSec_UpdateReputationAnalysis(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating ReputationAnalysis" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating ReputationAnalysis" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/reputation-analysis", withError: &Error{ Type: "internal_error", @@ -298,12 +298,12 @@ func TestAppSec_RemoveReputationAnalysis(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error deleting ReputationAnalysis" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error deleting ReputationAnalysis" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/reputation-analysis", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/reputation_profile_action_test.go b/pkg/appsec/reputation_profile_action_test.go index 99921408..bff2bf39 100644 --- a/pkg/appsec/reputation_profile_action_test.go +++ b/pkg/appsec/reputation_profile_action_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -132,12 +132,12 @@ func TestAppSec_GetReputationProfileAction(t *testing.T) { ReputationProfileID: 134644, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/reputation-profiles/134644", withError: &Error{ Type: "internal_error", @@ -215,12 +215,12 @@ func TestAppSec_UpdateReputationProfileAction(t *testing.T) { ReputationProfileID: 134644, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/reputation-profiles/134644", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/reputation_profile_test.go b/pkg/appsec/reputation_profile_test.go index 2057d723..205e3a3f 100644 --- a/pkg/appsec/reputation_profile_test.go +++ b/pkg/appsec/reputation_profile_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -128,12 +128,12 @@ func TestAppSec_GetReputationProfile(t *testing.T) { ReputationProfileId: 134644, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/reputation-profiles/134644", withError: &Error{ Type: "internal_error", @@ -209,12 +209,12 @@ func TestAppSec_CreateReputationProfile(t *testing.T) { ConfigVersion: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating domain" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating domain" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/reputation-profiles", withError: &Error{ Type: "internal_error", @@ -294,12 +294,12 @@ func TestAppSec_UpdateReputationProfile(t *testing.T) { ReputationProfileId: 134644, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/reputation-profiles/134644", withError: &Error{ Type: "internal_error", @@ -380,12 +380,12 @@ func TestAppSec_RemoveReputationProfile(t *testing.T) { ReputationProfileId: 134644, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error deleting match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error deleting match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/rate-policies/134644", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/reputation_protection_test.go b/pkg/appsec/reputation_protection_test.go index 0e194781..138d5461 100644 --- a/pkg/appsec/reputation_protection_test.go +++ b/pkg/appsec/reputation_protection_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -130,12 +130,12 @@ func TestAppSec_GetReputationProtection(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/protections", withError: &Error{ Type: "internal_error", @@ -211,12 +211,12 @@ func TestAppSec_UpdateReputationProtection(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/protections", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/rule_test.go b/pkg/appsec/rule_test.go index 54fa5afd..b87575c5 100644 --- a/pkg/appsec/rule_test.go +++ b/pkg/appsec/rule_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -132,12 +132,12 @@ func TestAppSec_GetRule(t *testing.T) { RuleID: 12345, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/rules/12345?includeConditionException=true", withError: &Error{ Type: "internal_error", @@ -208,12 +208,12 @@ func TestAppSec_UpdateRule(t *testing.T) { RuleID: 12345, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/rules", withError: &Error{ Type: "internal_error", @@ -288,12 +288,12 @@ func TestAppSec_UpdateRuleConditionException(t *testing.T) { RuleID: 12345, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/rules", withError: &Error{ Type: "internal_error", @@ -368,12 +368,12 @@ func TestAppSec_UpdateRuleAdvancedConditionException(t *testing.T) { RuleID: 12345, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/rules", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/rule_upgrade_test.go b/pkg/appsec/rule_upgrade_test.go index 4f5b96ad..67923b62 100644 --- a/pkg/appsec/rule_upgrade_test.go +++ b/pkg/appsec/rule_upgrade_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -130,12 +130,12 @@ func TestAppSec_GetRuleUpgrade(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/rules/upgrade-details", withError: &Error{ Type: "internal_error", @@ -211,12 +211,12 @@ func TestAppSec_UpdateRuleUpgrade(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/match-targets/%d", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/security_policy.go b/pkg/appsec/security_policy.go index 87546d46..0aa11045 100644 --- a/pkg/appsec/security_policy.go +++ b/pkg/appsec/security_policy.go @@ -133,6 +133,7 @@ type ( ApplyApplicationLayerControls bool `json:"applyApplicationLayerControls,omitempty"` ApplyAPIConstraints bool `json:"applyApiConstraints,omitempty"` ApplyBotmanControls bool `json:"applyBotmanControls,omitempty"` + ApplyMalwareControls bool `json:"applyMalwareControls,omitempty"` ApplyNetworkLayerControls bool `json:"applyNetworkLayerControls,omitempty"` ApplyRateControls bool `json:"applyRateControls,omitempty"` ApplyReputationControls bool `json:"applyReputationControls,omitempty"` diff --git a/pkg/appsec/security_policy_clone_test.go b/pkg/appsec/security_policy_clone_test.go index c2dd7bb2..6219d4a2 100644 --- a/pkg/appsec/security_policy_clone_test.go +++ b/pkg/appsec/security_policy_clone_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -126,12 +126,12 @@ func TestAppSec_GetSecurityPolicyClone(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/", withError: &Error{ Type: "internal_error", @@ -208,12 +208,12 @@ func TestAppSec_CreateSecurityPolicyClone(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating domain" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating domain" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/security_policy_protections_test.go b/pkg/appsec/security_policy_protections_test.go index 28282773..1226285c 100644 --- a/pkg/appsec/security_policy_protections_test.go +++ b/pkg/appsec/security_policy_protections_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -48,12 +48,12 @@ func TestAppSec_GetPolicyProtections(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/protections", withError: &Error{ Type: "internal_error", @@ -129,12 +129,12 @@ func TestAppSec_UpdatePolicyProtections(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/protections", withError: &Error{ Type: "internal_error", @@ -214,12 +214,12 @@ func TestAppSec_RemovePolicyProtections(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/protections", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/security_policy_test.go b/pkg/appsec/security_policy_test.go index 162af138..66350318 100644 --- a/pkg/appsec/security_policy_test.go +++ b/pkg/appsec/security_policy_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/appsec/selectable_hostnames_test.go b/pkg/appsec/selectable_hostnames_test.go index 2beb79be..f84b5415 100644 --- a/pkg/appsec/selectable_hostnames_test.go +++ b/pkg/appsec/selectable_hostnames_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -126,12 +126,12 @@ func TestAppSec_GetSelectableHostnames(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/selectable-hostnames", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/selected_hostname_test.go b/pkg/appsec/selected_hostname_test.go index 83d69cd0..fd2180b5 100644 --- a/pkg/appsec/selected_hostname_test.go +++ b/pkg/appsec/selected_hostname_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -126,12 +126,12 @@ func TestAppSec_GetSelectedHostname(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/selected-hostnames", withError: &Error{ Type: "internal_error", @@ -205,12 +205,12 @@ func TestAppSec_UpdateSelectedHostname(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/selected-hostnames", withError: &Error{ Type: "internal_error", @@ -288,12 +288,12 @@ func TestAppSec_UpdateSelectedHostnames(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/selected-hostnames", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/siem_settings_test.go b/pkg/appsec/siem_settings_test.go index 8a524be5..9e78ddc3 100644 --- a/pkg/appsec/siem_settings_test.go +++ b/pkg/appsec/siem_settings_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -126,12 +126,12 @@ func TestAppSec_GetSiemSettings(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/siem", withError: &Error{ Type: "internal_error", @@ -205,12 +205,12 @@ func TestAppSec_UpdateSiemSettings(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/siem", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/slow_post_protection_setting_test.go b/pkg/appsec/slow_post_protection_setting_test.go index e24030fc..753680ea 100644 --- a/pkg/appsec/slow_post_protection_setting_test.go +++ b/pkg/appsec/slow_post_protection_setting_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -130,12 +130,12 @@ func TestAppSec_GetSlowPostProtectionSetting(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/slow-post", withError: &Error{ Type: "internal_error", @@ -211,12 +211,12 @@ func TestAppSec_UpdateSlowPostProtectionSetting(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/slow-post", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/slowpost_protection_test.go b/pkg/appsec/slowpost_protection_test.go index 2b063916..acb50487 100644 --- a/pkg/appsec/slowpost_protection_test.go +++ b/pkg/appsec/slowpost_protection_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -130,12 +130,12 @@ func TestAppSec_GetSlowPostProtection(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/protections", withError: &Error{ Type: "internal_error", @@ -211,12 +211,12 @@ func TestAppSec_UpdateSlowPostProtection(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/protections", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/testdata/TestMalwarePolicy/MalwarePolicies.json b/pkg/appsec/testdata/TestMalwarePolicy/MalwarePolicies.json index 86ce151f..2e8ad806 100644 --- a/pkg/appsec/testdata/TestMalwarePolicy/MalwarePolicies.json +++ b/pkg/appsec/testdata/TestMalwarePolicy/MalwarePolicies.json @@ -12,9 +12,6 @@ "paths": [ "/base-path", "/test" - ], - "contentTypes": [ - "application/xml" ] }, { @@ -29,9 +26,6 @@ "paths": [ "/base-path", "/test" - ], - "contentTypes": [ - "application/xml" ] } ] diff --git a/pkg/appsec/testdata/TestMalwarePolicy/MalwarePolicy.json b/pkg/appsec/testdata/TestMalwarePolicy/MalwarePolicy.json index 6651eff3..10db082b 100644 --- a/pkg/appsec/testdata/TestMalwarePolicy/MalwarePolicy.json +++ b/pkg/appsec/testdata/TestMalwarePolicy/MalwarePolicy.json @@ -12,6 +12,16 @@ "/test" ], "contentTypes": [ - "application/xml" + { + "name": "application/json", + "encodedContentAttributes": [ + { + "path": "image.imagePath1", + "encoding": [ + "base64" + ] + } + ] + } ] } diff --git a/pkg/appsec/testdata/TestMalwarePolicy/MalwarePolicyDescription.json b/pkg/appsec/testdata/TestMalwarePolicy/MalwarePolicyDescription.json index 80a32ff7..452fd750 100644 --- a/pkg/appsec/testdata/TestMalwarePolicy/MalwarePolicyDescription.json +++ b/pkg/appsec/testdata/TestMalwarePolicy/MalwarePolicyDescription.json @@ -11,7 +11,17 @@ "/test" ], "contentTypes": [ - "application/xml" + { + "name": "application/json", + "encodedContentAttributes": [ + { + "path": "image.imagePath1", + "encoding": [ + "base64" + ] + } + ] + } ], "logFilename": true, "allowListId": "ListID_1", diff --git a/pkg/appsec/testdata/TestMalwarePolicy/MalwarePolicyResponse.json b/pkg/appsec/testdata/TestMalwarePolicy/MalwarePolicyResponse.json index cf06a08e..f20e5a3d 100644 --- a/pkg/appsec/testdata/TestMalwarePolicy/MalwarePolicyResponse.json +++ b/pkg/appsec/testdata/TestMalwarePolicy/MalwarePolicyResponse.json @@ -12,7 +12,17 @@ "/test" ], "contentTypes": [ - "application/xml" + { + "name": "application/json", + "encodedContentAttributes": [ + { + "path": "image.imagePath1", + "encoding": [ + "base64" + ] + } + ] + } ], "logFilename": true, "allowListId": "ListID_1", diff --git a/pkg/appsec/threat_intel_test.go b/pkg/appsec/threat_intel_test.go index f113e1af..d3aa5b68 100644 --- a/pkg/appsec/threat_intel_test.go +++ b/pkg/appsec/threat_intel_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -47,12 +47,12 @@ func TestAppSec_GetThreatIntel(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/threat-intel", withError: &Error{ Type: "internal_error", @@ -127,12 +127,12 @@ func TestAppSec_UpdateThreatIntel(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/threat-intel", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/tuning_recommendations_test.go b/pkg/appsec/tuning_recommendations_test.go index 51667aeb..d1ec595c 100644 --- a/pkg/appsec/tuning_recommendations_test.go +++ b/pkg/appsec/tuning_recommendations_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/appsec/version_notes_test.go b/pkg/appsec/version_notes_test.go index ad8c5c8b..df766b9d 100644 --- a/pkg/appsec/version_notes_test.go +++ b/pkg/appsec/version_notes_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -126,12 +126,12 @@ func TestAppSec_GetVersionNotes(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching VersionNotes" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching VersionNotes" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/version-notes", withError: &Error{ Type: "internal_error", @@ -205,12 +205,12 @@ func TestAppSec_UpdateVersionNotes(t *testing.T) { Version: 15, }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating VersionNotes" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating VersionNotes" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/version-notes", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/waf_mode_test.go b/pkg/appsec/waf_mode_test.go index d15d6fff..365a8477 100644 --- a/pkg/appsec/waf_mode_test.go +++ b/pkg/appsec/waf_mode_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -130,12 +130,12 @@ func TestAppSec_GetWAFMode(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/mode", withError: &Error{ Type: "internal_error", @@ -211,12 +211,12 @@ func TestAppSec_UpdateWAFMode(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/mode", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/waf_protection_test.go b/pkg/appsec/waf_protection_test.go index c4c2d7b6..bb2fc696 100644 --- a/pkg/appsec/waf_protection_test.go +++ b/pkg/appsec/waf_protection_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -130,12 +130,12 @@ func TestAppSec_GetWAFProtection(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching match target" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching match target" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/protections", withError: &Error{ Type: "internal_error", @@ -211,12 +211,12 @@ func TestAppSec_UpdateWAFProtection(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating zone" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating zone" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/protections", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/wap_bypass_network_lists_test.go b/pkg/appsec/wap_bypass_network_lists_test.go index fb1657d6..21e07025 100644 --- a/pkg/appsec/wap_bypass_network_lists_test.go +++ b/pkg/appsec/wap_bypass_network_lists_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -160,12 +160,12 @@ func TestAppSec_GetWAPBypassNetworkLists(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error fetching WAPBypassNetworkLists" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error fetching WAPBypassNetworkLists" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/bypass-network-lists", withError: &Error{ Type: "internal_error", @@ -240,12 +240,12 @@ func TestAppSec_UpdateWAPBypassNetworkLists(t *testing.T) { PolicyID: "AAAA_81230", }, responseStatus: http.StatusInternalServerError, - responseBody: (` -{ - "type": "internal_error", - "title": "Internal Server Error", - "detail": "Error creating WAPBypassNetworkLists" -}`), + responseBody: ` + { + "type": "internal_error", + "title": "Internal Server Error", + "detail": "Error creating WAPBypassNetworkLists" + }`, expectedPath: "/appsec/v1/configs/43253/versions/15/security-policies/AAAA_81230/bypass-network-lists", withError: &Error{ Type: "internal_error", diff --git a/pkg/appsec/wap_selected_hostnames_test.go b/pkg/appsec/wap_selected_hostnames_test.go index e3d55567..699d561c 100644 --- a/pkg/appsec/wap_selected_hostnames_test.go +++ b/pkg/appsec/wap_selected_hostnames_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/akamai_bot_category_action_test.go b/pkg/botman/akamai_bot_category_action_test.go index 97eebbac..50b7e1c9 100644 --- a/pkg/botman/akamai_bot_category_action_test.go +++ b/pkg/botman/akamai_bot_category_action_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/akamai_bot_category_test.go b/pkg/botman/akamai_bot_category_test.go index 150125de..97ce706f 100644 --- a/pkg/botman/akamai_bot_category_test.go +++ b/pkg/botman/akamai_bot_category_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/akamai_defined_bot_test.go b/pkg/botman/akamai_defined_bot_test.go index fb9aba02..d5d543e4 100644 --- a/pkg/botman/akamai_defined_bot_test.go +++ b/pkg/botman/akamai_defined_bot_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/bot_analytics_cookie_test.go b/pkg/botman/bot_analytics_cookie_test.go index 2ece04d2..0ed4e78e 100644 --- a/pkg/botman/bot_analytics_cookie_test.go +++ b/pkg/botman/bot_analytics_cookie_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/bot_analytics_cookie_values_test.go b/pkg/botman/bot_analytics_cookie_values_test.go index 5acf4b22..340232d4 100644 --- a/pkg/botman/bot_analytics_cookie_values_test.go +++ b/pkg/botman/bot_analytics_cookie_values_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/bot_category_exception_test.go b/pkg/botman/bot_category_exception_test.go index 0084424a..704e34fd 100644 --- a/pkg/botman/bot_category_exception_test.go +++ b/pkg/botman/bot_category_exception_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/pkg/botman/bot_detection_action_test.go b/pkg/botman/bot_detection_action_test.go index ab5a9b49..f2c30f20 100644 --- a/pkg/botman/bot_detection_action_test.go +++ b/pkg/botman/bot_detection_action_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/bot_detection_test.go b/pkg/botman/bot_detection_test.go index 48f882ef..2e406126 100644 --- a/pkg/botman/bot_detection_test.go +++ b/pkg/botman/bot_detection_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/bot_endpoint_coverage_report_test.go b/pkg/botman/bot_endpoint_coverage_report_test.go index d43d0d35..693e4b13 100644 --- a/pkg/botman/bot_endpoint_coverage_report_test.go +++ b/pkg/botman/bot_endpoint_coverage_report_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/bot_management_setting_test.go b/pkg/botman/bot_management_setting_test.go index 48efc819..db758644 100644 --- a/pkg/botman/bot_management_setting_test.go +++ b/pkg/botman/bot_management_setting_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/pkg/botman/botman.go b/pkg/botman/botman.go index 18fca59f..b2a22100 100644 --- a/pkg/botman/botman.go +++ b/pkg/botman/botman.go @@ -4,7 +4,7 @@ package botman import ( "errors" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" ) var ( diff --git a/pkg/botman/botman_test.go b/pkg/botman/botman_test.go index 7bf04a43..65db0bdc 100644 --- a/pkg/botman/botman_test.go +++ b/pkg/botman/botman_test.go @@ -12,8 +12,8 @@ import ( "net/url" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegrid" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegrid" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/challenge_action_test.go b/pkg/botman/challenge_action_test.go index 2a628aff..ebead2d9 100644 --- a/pkg/botman/challenge_action_test.go +++ b/pkg/botman/challenge_action_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/challenge_interception_rules_test.go b/pkg/botman/challenge_interception_rules_test.go index b068f28b..35b8f57f 100644 --- a/pkg/botman/challenge_interception_rules_test.go +++ b/pkg/botman/challenge_interception_rules_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/client_side_security_test.go b/pkg/botman/client_side_security_test.go index 3ee8654b..d201e72a 100644 --- a/pkg/botman/client_side_security_test.go +++ b/pkg/botman/client_side_security_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/conditonal_action_test.go b/pkg/botman/conditonal_action_test.go index bb1ab37a..e77eb9ca 100644 --- a/pkg/botman/conditonal_action_test.go +++ b/pkg/botman/conditonal_action_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/custom_bot_category_action_test.go b/pkg/botman/custom_bot_category_action_test.go index 15512e24..b2423c8a 100644 --- a/pkg/botman/custom_bot_category_action_test.go +++ b/pkg/botman/custom_bot_category_action_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/custom_bot_category_sequence_test.go b/pkg/botman/custom_bot_category_sequence_test.go index 2602d585..6750e0ff 100644 --- a/pkg/botman/custom_bot_category_sequence_test.go +++ b/pkg/botman/custom_bot_category_sequence_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/custom_bot_category_test.go b/pkg/botman/custom_bot_category_test.go index b5b1d0ed..c2fea3a9 100644 --- a/pkg/botman/custom_bot_category_test.go +++ b/pkg/botman/custom_bot_category_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/custom_client_test.go b/pkg/botman/custom_client_test.go index a5db38f3..68bca0e5 100644 --- a/pkg/botman/custom_client_test.go +++ b/pkg/botman/custom_client_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/custom_defined_bot_test.go b/pkg/botman/custom_defined_bot_test.go index cda4cfd3..1a70182e 100644 --- a/pkg/botman/custom_defined_bot_test.go +++ b/pkg/botman/custom_defined_bot_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/custom_deny_action_test.go b/pkg/botman/custom_deny_action_test.go index 7d547872..7d81213e 100644 --- a/pkg/botman/custom_deny_action_test.go +++ b/pkg/botman/custom_deny_action_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/javascript_injection_test.go b/pkg/botman/javascript_injection_test.go index 3821951e..309f4319 100644 --- a/pkg/botman/javascript_injection_test.go +++ b/pkg/botman/javascript_injection_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/recategorized_akamai_defined_bot_test.go b/pkg/botman/recategorized_akamai_defined_bot_test.go index 8bc59967..57baf11e 100644 --- a/pkg/botman/recategorized_akamai_defined_bot_test.go +++ b/pkg/botman/recategorized_akamai_defined_bot_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/response_action_test.go b/pkg/botman/response_action_test.go index 41b71143..30dc66fd 100644 --- a/pkg/botman/response_action_test.go +++ b/pkg/botman/response_action_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/serve_alternate_action_test.go b/pkg/botman/serve_alternate_action_test.go index 27e2dd24..3c6e3585 100644 --- a/pkg/botman/serve_alternate_action_test.go +++ b/pkg/botman/serve_alternate_action_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/transactional_endpoint_protection_test.go b/pkg/botman/transactional_endpoint_protection_test.go index 13fe519a..09f54ab2 100644 --- a/pkg/botman/transactional_endpoint_protection_test.go +++ b/pkg/botman/transactional_endpoint_protection_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/botman/transactional_endpoint_test.go b/pkg/botman/transactional_endpoint_test.go index edfa262f..af283769 100644 --- a/pkg/botman/transactional_endpoint_test.go +++ b/pkg/botman/transactional_endpoint_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/cloudlets/cloudlets.go b/pkg/cloudlets/cloudlets.go index 988c88f6..edbeba43 100644 --- a/pkg/cloudlets/cloudlets.go +++ b/pkg/cloudlets/cloudlets.go @@ -4,7 +4,7 @@ package cloudlets import ( "errors" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" ) var ( diff --git a/pkg/cloudlets/cloudlets_test.go b/pkg/cloudlets/cloudlets_test.go index 2944c482..fcc2baba 100644 --- a/pkg/cloudlets/cloudlets_test.go +++ b/pkg/cloudlets/cloudlets_test.go @@ -8,8 +8,8 @@ import ( "net/url" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegrid" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegrid" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/cloudlets/errors_test.go b/pkg/cloudlets/errors_test.go index ec1d4bf2..6d147137 100644 --- a/pkg/cloudlets/errors_test.go +++ b/pkg/cloudlets/errors_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/require" "github.com/tj/assert" ) diff --git a/pkg/cloudlets/loadbalancer.go b/pkg/cloudlets/loadbalancer.go index 2dc07a8f..fffb88e9 100644 --- a/pkg/cloudlets/loadbalancer.go +++ b/pkg/cloudlets/loadbalancer.go @@ -7,7 +7,7 @@ import ( "net/http" "net/url" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/cloudlets/loadbalancer_activation.go b/pkg/cloudlets/loadbalancer_activation.go index e63f3750..2ce89b92 100644 --- a/pkg/cloudlets/loadbalancer_activation.go +++ b/pkg/cloudlets/loadbalancer_activation.go @@ -8,7 +8,7 @@ import ( "net/url" "strconv" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/cloudlets/loadbalancer_activation_test.go b/pkg/cloudlets/loadbalancer_activation_test.go index d178bc69..bc5129b1 100644 --- a/pkg/cloudlets/loadbalancer_activation_test.go +++ b/pkg/cloudlets/loadbalancer_activation_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/pkg/cloudlets/loadbalancer_version.go b/pkg/cloudlets/loadbalancer_version.go index a1b3e1e6..a5e4d559 100644 --- a/pkg/cloudlets/loadbalancer_version.go +++ b/pkg/cloudlets/loadbalancer_version.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/cloudlets/loadbalancer_version_test.go b/pkg/cloudlets/loadbalancer_version_test.go index 5fe17f20..77a24257 100644 --- a/pkg/cloudlets/loadbalancer_version_test.go +++ b/pkg/cloudlets/loadbalancer_version_test.go @@ -9,7 +9,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" validation "github.com/go-ozzo/ozzo-validation/v4" "github.com/stretchr/testify/require" diff --git a/pkg/cloudlets/match_rule.go b/pkg/cloudlets/match_rule.go index 79372d5e..a5bddcfe 100644 --- a/pkg/cloudlets/match_rule.go +++ b/pkg/cloudlets/match_rule.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/cloudlets/match_rule_test.go b/pkg/cloudlets/match_rule_test.go index b8d8f139..009244d0 100644 --- a/pkg/cloudlets/match_rule_test.go +++ b/pkg/cloudlets/match_rule_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" "github.com/tj/assert" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" ) func TestUnmarshalJSONMatchRules(t *testing.T) { diff --git a/pkg/cloudlets/mocks.go b/pkg/cloudlets/mocks.go index b7cc95dd..d91a82fe 100644 --- a/pkg/cloudlets/mocks.go +++ b/pkg/cloudlets/mocks.go @@ -67,9 +67,12 @@ func (m *Mock) ListPolicyActivations(ctx context.Context, req ListPolicyActivati return args.Get(0).([]PolicyActivation), args.Error(1) } -func (m *Mock) ActivatePolicyVersion(ctx context.Context, req ActivatePolicyVersionRequest) error { +func (m *Mock) ActivatePolicyVersion(ctx context.Context, req ActivatePolicyVersionRequest) ([]PolicyActivation, error) { args := m.Called(ctx, req) - return args.Error(0) + if args.Get(0) == nil { + return nil, args.Error(1) + } + return args.Get(0).([]PolicyActivation), args.Error(1) } func (m *Mock) ListOrigins(ctx context.Context, req ListOriginsRequest) ([]OriginResponse, error) { diff --git a/pkg/cloudlets/policy_property.go b/pkg/cloudlets/policy_property.go index 1baf90d6..81c8126d 100644 --- a/pkg/cloudlets/policy_property.go +++ b/pkg/cloudlets/policy_property.go @@ -7,7 +7,7 @@ import ( "net/http" "net/url" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/cloudlets/policy_test.go b/pkg/cloudlets/policy_test.go index 36d4a78e..b6700983 100644 --- a/pkg/cloudlets/policy_test.go +++ b/pkg/cloudlets/policy_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" "github.com/stretchr/testify/require" "github.com/tj/assert" diff --git a/pkg/cloudlets/policy_version.go b/pkg/cloudlets/policy_version.go index 8aa1c1f5..e017cf27 100644 --- a/pkg/cloudlets/policy_version.go +++ b/pkg/cloudlets/policy_version.go @@ -8,7 +8,7 @@ import ( "net/url" "strconv" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/cloudlets/policy_version_activation.go b/pkg/cloudlets/policy_version_activation.go index ec61cf78..718a898e 100644 --- a/pkg/cloudlets/policy_version_activation.go +++ b/pkg/cloudlets/policy_version_activation.go @@ -8,7 +8,7 @@ import ( "net/http" "net/url" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) @@ -24,7 +24,7 @@ type ( // ActivatePolicyVersion activates the selected cloudlet policy version. // // See: https://techdocs.akamai.com/cloudlets/v2/reference/post-policy-version-activations - ActivatePolicyVersion(context.Context, ActivatePolicyVersionRequest) error + ActivatePolicyVersion(context.Context, ActivatePolicyVersionRequest) ([]PolicyActivation, error) } // ListPolicyActivationsRequest contains the request parameters for ListPolicyActivations @@ -149,33 +149,34 @@ func (c *cloudlets) ListPolicyActivations(ctx context.Context, params ListPolicy return result, nil } -func (c *cloudlets) ActivatePolicyVersion(ctx context.Context, params ActivatePolicyVersionRequest) error { +func (c *cloudlets) ActivatePolicyVersion(ctx context.Context, params ActivatePolicyVersionRequest) ([]PolicyActivation, error) { c.Log(ctx).Debug("ActivatePolicyVersion") if err := params.Validate(); err != nil { - return fmt.Errorf("%s: %w:\n%s", ErrActivatePolicyVersion, ErrStructValidation, err) + return nil, fmt.Errorf("%s: %w:\n%s", ErrActivatePolicyVersion, ErrStructValidation, err) } uri, err := url.Parse(fmt.Sprintf( "/cloudlets/api/v2/policies/%d/versions/%d/activations", params.PolicyID, params.Version)) if err != nil { - return fmt.Errorf("%w: failed to create POST URI: %s", ErrActivatePolicyVersion, err) + return nil, fmt.Errorf("%w: failed to create POST URI: %s", ErrActivatePolicyVersion, err) } req, err := http.NewRequestWithContext(ctx, http.MethodPost, uri.String(), nil) if err != nil { - return fmt.Errorf("%w: failed to create POST request: %s", ErrActivatePolicyVersion, err) + return nil, fmt.Errorf("%w: failed to create POST request: %s", ErrActivatePolicyVersion, err) } - response, err := c.Exec(req, nil, params.PolicyVersionActivation) + var result []PolicyActivation + response, err := c.Exec(req, &result, params.PolicyVersionActivation) if err != nil { - return fmt.Errorf("%w: request failed: %s", ErrActivatePolicyVersion, err) + return nil, fmt.Errorf("%w: request failed: %s", ErrActivatePolicyVersion, err) } if response.StatusCode >= http.StatusBadRequest { - return fmt.Errorf("%w: %s", ErrActivatePolicyVersion, c.Error(response)) + return nil, fmt.Errorf("%w: %s", ErrActivatePolicyVersion, c.Error(response)) } - return nil + return result, nil } diff --git a/pkg/cloudlets/policy_version_activation_test.go b/pkg/cloudlets/policy_version_activation_test.go index 14fce531..c19ff24c 100644 --- a/pkg/cloudlets/policy_version_activation_test.go +++ b/pkg/cloudlets/policy_version_activation_test.go @@ -152,6 +152,7 @@ func TestActivatePolicyVersion(t *testing.T) { responseStatus int uri string responseBody string + expectedResponse []PolicyActivation expectedActivation PolicyVersionActivation withError func(*testing.T, error) }{ @@ -165,19 +166,53 @@ func TestActivatePolicyVersion(t *testing.T) { AdditionalPropertyNames: []string{"www.rc-cloudlet.com"}, }, }, - responseBody: `{ - "revisionId": 11870, - "policyId": 1001, - "version": 2, - "description": "v2", - "createdBy": "jsmith", - "createDate": 1427133784903, - "lastModifiedBy": "sjones", - "lastModifiedDate": 1427133805767, - "activations": [], - "matchRules": [], - "rulesLocked": false -}`, + responseBody: `[ + { + "serviceVersion": null, + "apiVersion": "2.0", + "network": "staging", + "policyInfo": { + "policyId": 2962, + "name": "RequestControlPolicy", + "version": 1, + "status": "pending", + "statusDetail": "initial", + "activationDate": 1427428800000, + "activatedBy": "jsmith" + }, + "propertyInfo": { + "name": "www.rc-cloudlet.com", + "version": 0, + "groupId": 40498, + "status": "inactive", + "activatedBy": null, + "activationDate": 0 + } + } + ]`, + expectedResponse: []PolicyActivation{ + { + APIVersion: "2.0", + Network: PolicyActivationNetworkStaging, + PropertyInfo: PropertyInfo{ + Name: "www.rc-cloudlet.com", + Version: 0, + GroupID: 40498, + Status: PolicyActivationStatusInactive, + ActivatedBy: "", + ActivationDate: 0, + }, + PolicyInfo: PolicyInfo{ + PolicyID: 2962, + Name: "RequestControlPolicy", + Version: 1, + Status: PolicyActivationStatusPending, + StatusDetail: "initial", + ActivatedBy: "jsmith", + ActivationDate: 1427428800000, + }, + }, + }, }, "any request validation error": { parameters: ActivatePolicyVersionRequest{}, @@ -250,12 +285,13 @@ func TestActivatePolicyVersion(t *testing.T) { assert.NoError(t, err) })) client := mockAPIClient(t, mockServer) - err := client.ActivatePolicyVersion(context.Background(), test.parameters) + result, err := client.ActivatePolicyVersion(context.Background(), test.parameters) if test.withError != nil { test.withError(t, err) return } require.NoError(t, err) + assert.Equal(t, test.expectedResponse, result) }) } } diff --git a/pkg/cloudlets/policy_version_test.go b/pkg/cloudlets/policy_version_test.go index abe74619..ab1dabbd 100644 --- a/pkg/cloudlets/policy_version_test.go +++ b/pkg/cloudlets/policy_version_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" "github.com/stretchr/testify/require" "github.com/tj/assert" diff --git a/pkg/cps/change_management_info_test.go b/pkg/cps/change_management_info_test.go index fd779973..5a6b8d8b 100644 --- a/pkg/cps/change_management_info_test.go +++ b/pkg/cps/change_management_info_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/pkg/cps/cps.go b/pkg/cps/cps.go index 47b9dfcf..78a7b028 100644 --- a/pkg/cps/cps.go +++ b/pkg/cps/cps.go @@ -4,7 +4,7 @@ package cps import ( "errors" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" ) var ( diff --git a/pkg/cps/cps_test.go b/pkg/cps/cps_test.go index 3d4254f0..14c34a77 100644 --- a/pkg/cps/cps_test.go +++ b/pkg/cps/cps_test.go @@ -8,8 +8,8 @@ import ( "net/url" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegrid" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegrid" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/cps/deployment_schedules_test.go b/pkg/cps/deployment_schedules_test.go index c32fd8fd..162038b5 100644 --- a/pkg/cps/deployment_schedules_test.go +++ b/pkg/cps/deployment_schedules_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/cps/deployments_test.go b/pkg/cps/deployments_test.go index fea91f3f..0e703bb6 100644 --- a/pkg/cps/deployments_test.go +++ b/pkg/cps/deployments_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/cps/errors_test.go b/pkg/cps/errors_test.go index 12fa4379..89d8cce3 100644 --- a/pkg/cps/errors_test.go +++ b/pkg/cps/errors_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/require" "github.com/tj/assert" ) diff --git a/pkg/cps/third_party_csr.go b/pkg/cps/third_party_csr.go index a4fdf923..2fc9af34 100644 --- a/pkg/cps/third_party_csr.go +++ b/pkg/cps/third_party_csr.go @@ -6,7 +6,7 @@ import ( "fmt" "net/http" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/datastream/ds.go b/pkg/datastream/ds.go index f266b851..a320cf50 100644 --- a/pkg/datastream/ds.go +++ b/pkg/datastream/ds.go @@ -6,7 +6,7 @@ package datastream import ( "errors" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" ) var ( diff --git a/pkg/datastream/ds_test.go b/pkg/datastream/ds_test.go index 1921220b..c2c05c96 100644 --- a/pkg/datastream/ds_test.go +++ b/pkg/datastream/ds_test.go @@ -8,8 +8,8 @@ import ( "net/url" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegrid" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegrid" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/require" "github.com/tj/assert" ) diff --git a/pkg/datastream/errors_test.go b/pkg/datastream/errors_test.go index bc53d257..5a71d65b 100644 --- a/pkg/datastream/errors_test.go +++ b/pkg/datastream/errors_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/datastream/stream_test.go b/pkg/datastream/stream_test.go index 1e3d98f4..d7819a20 100644 --- a/pkg/datastream/stream_test.go +++ b/pkg/datastream/stream_test.go @@ -9,7 +9,7 @@ import ( "reflect" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/dns/authorities_test.go b/pkg/dns/authorities_test.go index 07d8a39e..50b2b3ae 100644 --- a/pkg/dns/authorities_test.go +++ b/pkg/dns/authorities_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/dns/dns.go b/pkg/dns/dns.go index 2af84dc3..5aa8c2e4 100644 --- a/pkg/dns/dns.go +++ b/pkg/dns/dns.go @@ -7,7 +7,7 @@ import ( "errors" "net/http" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" ) var ( diff --git a/pkg/dns/dns_test.go b/pkg/dns/dns_test.go index f66ee6aa..f0e670cb 100644 --- a/pkg/dns/dns_test.go +++ b/pkg/dns/dns_test.go @@ -8,8 +8,8 @@ import ( "net/url" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegrid" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegrid" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/dns/record_lookup_test.go b/pkg/dns/record_lookup_test.go index 7d08dec3..e5f7437d 100644 --- a/pkg/dns/record_lookup_test.go +++ b/pkg/dns/record_lookup_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/dns/record_test.go b/pkg/dns/record_test.go index 2c222378..7f4ee111 100644 --- a/pkg/dns/record_test.go +++ b/pkg/dns/record_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/dns/tsig_test.go b/pkg/dns/tsig_test.go index ac42d3f1..58bc20e6 100644 --- a/pkg/dns/tsig_test.go +++ b/pkg/dns/tsig_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/dns/zone_test.go b/pkg/dns/zone_test.go index dd2c2f84..7d981ed4 100644 --- a/pkg/dns/zone_test.go +++ b/pkg/dns/zone_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/edgeworkers/edgekv_groups.go b/pkg/edgeworkers/edgekv_groups.go index 35b05342..fbfef9b5 100644 --- a/pkg/edgeworkers/edgekv_groups.go +++ b/pkg/edgeworkers/edgekv_groups.go @@ -6,7 +6,7 @@ import ( "fmt" "net/http" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/edgeworkers/edgekv_namespaces_test.go b/pkg/edgeworkers/edgekv_namespaces_test.go index a107387a..94e74a35 100644 --- a/pkg/edgeworkers/edgekv_namespaces_test.go +++ b/pkg/edgeworkers/edgekv_namespaces_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/edgeworkers/edgeworkers.go b/pkg/edgeworkers/edgeworkers.go index a2982b74..479d23f1 100644 --- a/pkg/edgeworkers/edgeworkers.go +++ b/pkg/edgeworkers/edgeworkers.go @@ -4,7 +4,7 @@ package edgeworkers import ( "errors" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" ) var ( diff --git a/pkg/edgeworkers/edgeworkers_test.go b/pkg/edgeworkers/edgeworkers_test.go index d0796722..318629c4 100644 --- a/pkg/edgeworkers/edgeworkers_test.go +++ b/pkg/edgeworkers/edgeworkers_test.go @@ -8,8 +8,8 @@ import ( "net/url" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegrid" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegrid" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/edgeworkers/errors_test.go b/pkg/edgeworkers/errors_test.go index 25e37a40..457c74ac 100644 --- a/pkg/edgeworkers/errors_test.go +++ b/pkg/edgeworkers/errors_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/require" "github.com/tj/assert" ) diff --git a/pkg/edgeworkers/report_test.go b/pkg/edgeworkers/report_test.go index aa740fe2..be3ddbe9 100644 --- a/pkg/edgeworkers/report_test.go +++ b/pkg/edgeworkers/report_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/gtm/asmap_test.go b/pkg/gtm/asmap_test.go index 4995db57..aecb29d4 100644 --- a/pkg/gtm/asmap_test.go +++ b/pkg/gtm/asmap_test.go @@ -9,7 +9,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/gtm/cidrmap_test.go b/pkg/gtm/cidrmap_test.go index d5d4e9a5..fed86eff 100644 --- a/pkg/gtm/cidrmap_test.go +++ b/pkg/gtm/cidrmap_test.go @@ -9,7 +9,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/gtm/datacenter_test.go b/pkg/gtm/datacenter_test.go index ff70fa3b..acb67866 100644 --- a/pkg/gtm/datacenter_test.go +++ b/pkg/gtm/datacenter_test.go @@ -9,7 +9,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/gtm/domain_test.go b/pkg/gtm/domain_test.go index 9bc6f343..158193e3 100644 --- a/pkg/gtm/domain_test.go +++ b/pkg/gtm/domain_test.go @@ -10,7 +10,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/gtm/geomap_test.go b/pkg/gtm/geomap_test.go index cd51647a..e3bbef78 100644 --- a/pkg/gtm/geomap_test.go +++ b/pkg/gtm/geomap_test.go @@ -9,7 +9,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/gtm/gtm.go b/pkg/gtm/gtm.go index ed96cc8b..16b8a7da 100644 --- a/pkg/gtm/gtm.go +++ b/pkg/gtm/gtm.go @@ -7,7 +7,7 @@ import ( "errors" "net/http" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" ) var ( diff --git a/pkg/gtm/gtm_test.go b/pkg/gtm/gtm_test.go index 10a01d03..876e97d4 100644 --- a/pkg/gtm/gtm_test.go +++ b/pkg/gtm/gtm_test.go @@ -10,8 +10,8 @@ import ( "net/url" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegrid" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegrid" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/gtm/property_test.go b/pkg/gtm/property_test.go index 8e5131d2..355df63f 100644 --- a/pkg/gtm/property_test.go +++ b/pkg/gtm/property_test.go @@ -9,7 +9,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/gtm/resource_test.go b/pkg/gtm/resource_test.go index b11e82c8..882608c1 100644 --- a/pkg/gtm/resource_test.go +++ b/pkg/gtm/resource_test.go @@ -9,7 +9,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/hapi/edgehostname.go b/pkg/hapi/edgehostname.go index d8e57a02..43f60d3f 100644 --- a/pkg/hapi/edgehostname.go +++ b/pkg/hapi/edgehostname.go @@ -10,7 +10,7 @@ import ( "net/http" "strings" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) @@ -135,7 +135,6 @@ type ( UseDefaultTTL bool `json:"useDefaultTtl"` UseDefaultMap bool `json:"useDefaultMap"` IPVersionBehavior string `json:"ipVersionBehavior"` - ProductID string `json:"productId"` TTL int `json:"ttl"` Map string `json:"map,omitempty"` SlotNumber int `json:"slotNumber,omitempty"` diff --git a/pkg/hapi/edgehostname_test.go b/pkg/hapi/edgehostname_test.go index 47cfedf0..dc3d55d3 100644 --- a/pkg/hapi/edgehostname_test.go +++ b/pkg/hapi/edgehostname_test.go @@ -188,7 +188,6 @@ func TestGetEdgeHostname(t *testing.T) { "edgeHostnameId": 4617960, "ipVersionBehavior": "IPV6_IPV4_DUALSTACK", "map": "e;dscx.akamaiedge.net", - "productId": "IONSPM", "recordName": "aws_ci_pearltest-asorigin-na-as-eu-ionp.cumulus-essl.webexp-ipqa-ion.com-v2", "securityType": "ENHANCED-TLS", "slotNumber": 47463, @@ -206,7 +205,6 @@ func TestGetEdgeHostname(t *testing.T) { EdgeHostnameID: 4617960, IPVersionBehavior: "IPV6_IPV4_DUALSTACK", Map: "e;dscx.akamaiedge.net", - ProductID: "IONSPM", RecordName: "aws_ci_pearltest-asorigin-na-as-eu-ionp.cumulus-essl.webexp-ipqa-ion.com-v2", SecurityType: "ENHANCED-TLS", SlotNumber: 47463, diff --git a/pkg/hapi/errors_test.go b/pkg/hapi/errors_test.go index 9968ae67..2e04f89f 100644 --- a/pkg/hapi/errors_test.go +++ b/pkg/hapi/errors_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/require" "github.com/tj/assert" ) diff --git a/pkg/hapi/hapi.go b/pkg/hapi/hapi.go index 80591b15..8afc8ed0 100644 --- a/pkg/hapi/hapi.go +++ b/pkg/hapi/hapi.go @@ -6,7 +6,7 @@ package hapi import ( "errors" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" ) var ( diff --git a/pkg/hapi/hapi_test.go b/pkg/hapi/hapi_test.go index a354d776..0640adcc 100644 --- a/pkg/hapi/hapi_test.go +++ b/pkg/hapi/hapi_test.go @@ -8,8 +8,8 @@ import ( "net/url" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegrid" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegrid" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/iam/errors_test.go b/pkg/iam/errors_test.go index 7766e5be..b93574cb 100644 --- a/pkg/iam/errors_test.go +++ b/pkg/iam/errors_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/require" "github.com/tj/assert" ) diff --git a/pkg/iam/iam.go b/pkg/iam/iam.go index 306fd8d1..e622c697 100644 --- a/pkg/iam/iam.go +++ b/pkg/iam/iam.go @@ -4,7 +4,7 @@ package iam import ( "errors" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" ) var ( diff --git a/pkg/iam/iam_test.go b/pkg/iam/iam_test.go index 185da0d7..097c3b36 100644 --- a/pkg/iam/iam_test.go +++ b/pkg/iam/iam_test.go @@ -8,8 +8,8 @@ import ( "net/url" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegrid" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegrid" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/iam/user_test.go b/pkg/iam/user_test.go index 2217a457..97b3f70c 100644 --- a/pkg/iam/user_test.go +++ b/pkg/iam/user_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" "github.com/stretchr/testify/require" "github.com/tj/assert" ) diff --git a/pkg/imaging/errors_test.go b/pkg/imaging/errors_test.go index 75d6b553..52c5e1a4 100644 --- a/pkg/imaging/errors_test.go +++ b/pkg/imaging/errors_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/require" "github.com/tj/assert" ) diff --git a/pkg/imaging/imaging.go b/pkg/imaging/imaging.go index 751ab989..ce985d03 100644 --- a/pkg/imaging/imaging.go +++ b/pkg/imaging/imaging.go @@ -4,7 +4,7 @@ package imaging import ( "errors" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" ) var ( diff --git a/pkg/imaging/imaging_test.go b/pkg/imaging/imaging_test.go index aac9f527..b3c2650b 100644 --- a/pkg/imaging/imaging_test.go +++ b/pkg/imaging/imaging_test.go @@ -8,8 +8,8 @@ import ( "net/url" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegrid" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegrid" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/imaging/policy.go b/pkg/imaging/policy.go index 14c1bfc8..0a7c4bc9 100644 --- a/pkg/imaging/policy.go +++ b/pkg/imaging/policy.go @@ -7,7 +7,7 @@ import ( "fmt" "net/http" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/imaging/policy_test.go b/pkg/imaging/policy_test.go index ea47bb25..76ef3e47 100644 --- a/pkg/imaging/policy_test.go +++ b/pkg/imaging/policy_test.go @@ -9,7 +9,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/imaging/policyset.go b/pkg/imaging/policyset.go index d71a72be..77b3bf90 100644 --- a/pkg/imaging/policyset.go +++ b/pkg/imaging/policyset.go @@ -7,7 +7,7 @@ import ( "net/http" "net/url" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/networklists/activations_test.go b/pkg/networklists/activations_test.go index dba9e73c..81d3d58a 100644 --- a/pkg/networklists/activations_test.go +++ b/pkg/networklists/activations_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/networklists/errors_test.go b/pkg/networklists/errors_test.go index 7ac42d0c..f76b82d6 100644 --- a/pkg/networklists/errors_test.go +++ b/pkg/networklists/errors_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/require" "github.com/tj/assert" ) diff --git a/pkg/networklists/network_list_description_test.go b/pkg/networklists/network_list_description_test.go index 53ed1872..2c57031e 100644 --- a/pkg/networklists/network_list_description_test.go +++ b/pkg/networklists/network_list_description_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/networklists/network_list_subscription_test.go b/pkg/networklists/network_list_subscription_test.go index 8b4e1a8f..434cb90f 100644 --- a/pkg/networklists/network_list_subscription_test.go +++ b/pkg/networklists/network_list_subscription_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/networklists/network_list_test.go b/pkg/networklists/network_list_test.go index 7e22616d..fe4844bc 100644 --- a/pkg/networklists/network_list_test.go +++ b/pkg/networklists/network_list_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/networklists/networklists.go b/pkg/networklists/networklists.go index 6b84adcb..caebce0e 100644 --- a/pkg/networklists/networklists.go +++ b/pkg/networklists/networklists.go @@ -6,7 +6,7 @@ package networklists import ( "errors" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" ) var ( diff --git a/pkg/networklists/networklists_test.go b/pkg/networklists/networklists_test.go index cded5117..9ba03c0e 100644 --- a/pkg/networklists/networklists_test.go +++ b/pkg/networklists/networklists_test.go @@ -12,8 +12,8 @@ import ( "net/url" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegrid" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegrid" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/papi/cpcode_test.go b/pkg/papi/cpcode_test.go index 8eb0609b..f7f11093 100644 --- a/pkg/papi/cpcode_test.go +++ b/pkg/papi/cpcode_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/papi/edgehostname.go b/pkg/papi/edgehostname.go index 300f7423..a0d0471d 100644 --- a/pkg/papi/edgehostname.go +++ b/pkg/papi/edgehostname.go @@ -7,7 +7,7 @@ import ( "net/http" "strings" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/papi/errors.go b/pkg/papi/errors.go index 0f05dc53..a5c5e6a4 100644 --- a/pkg/papi/errors.go +++ b/pkg/papi/errors.go @@ -24,6 +24,24 @@ type ( Limit *int `json:"limit,omitempty"` Remaining *int `json:"remaining,omitempty"` } + + // ActivationError represents errors returned in validation objects in include activation response + ActivationError struct { + Type string `json:"type"` + Title string `json:"title"` + Instance string `json:"instance"` + Status int `json:"status"` + Errors []ActivationErrorMessage `json:"errors"` + MessageID string `json:"messageId"` + Result string `json:"result"` + } + + // ActivationErrorMessage represents detailed information about validation errors + ActivationErrorMessage struct { + Type string `json:"type"` + Title string `json:"title"` + Detail string `json:"detail"` + } ) // Error parses an error from the response @@ -60,6 +78,14 @@ func (e *Error) Error() string { return fmt.Sprintf("API error: \n%s", msg) } +func (e *ActivationError) Error() string { + msg, err := json.MarshalIndent(e, "", "\t") + if err != nil { + return fmt.Sprintf("error marshaling API error: %s", err) + } + return fmt.Sprintf("API error: \n%s", msg) +} + // Is handles error comparisons func (e *Error) Is(target error) bool { if errors.Is(target, ErrSBDNotEnabled) { @@ -85,6 +111,28 @@ func (e *Error) Is(target error) bool { return e.Error() == t.Error() } +// Is handles error comparisons for ActivationError type +func (e *ActivationError) Is(target error) bool { + if errors.Is(target, ErrMissingComplianceRecord) { + return e.MessageID == "missing_compliance_record" + } + + var t *ActivationError + if !errors.As(target, &t) { + return false + } + + if e == t { + return true + } + + if e.Status != t.Status { + return false + } + + return e.Error() == t.Error() +} + func (e *Error) isErrSBDNotEnabled() bool { return e.StatusCode == http.StatusForbidden && e.Type == "https://problems.luna.akamaiapis.net/papi/v0/property-version-hostname/default-cert-provisioning-unavailable" } diff --git a/pkg/papi/errors_test.go b/pkg/papi/errors_test.go index 5819911a..0b32019b 100644 --- a/pkg/papi/errors_test.go +++ b/pkg/papi/errors_test.go @@ -8,8 +8,8 @@ import ( "strings" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" "github.com/stretchr/testify/require" "github.com/tj/assert" ) diff --git a/pkg/papi/include.go b/pkg/papi/include.go index 46178c1c..c46b114d 100644 --- a/pkg/papi/include.go +++ b/pkg/papi/include.go @@ -7,7 +7,7 @@ import ( "net/http" "net/url" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/papi/include_activations.go b/pkg/papi/include_activations.go index 7429d208..51d76f69 100644 --- a/pkg/papi/include_activations.go +++ b/pkg/papi/include_activations.go @@ -7,9 +7,10 @@ import ( "fmt" "net/http" "net/url" + "strings" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" validation "github.com/go-ozzo/ozzo-validation/v4" ) @@ -115,6 +116,7 @@ type ( HasSystemError bool `json:"hasSystemError"` HasClientError bool `json:"hasClientError"` MessageState string `json:"messageState"` + ErrorMessage string `json:"errorMessage"` } // ValidationProgress represents include activation validation progress object @@ -520,6 +522,15 @@ func (p *papi) GetIncludeActivation(ctx context.Context, params GetIncludeActiva return nil, fmt.Errorf("%s: %w", ErrGetIncludeActivation, p.Error(resp)) } + if result.Validations != nil { + val := result.Validations.ValidationSummary + if val.HasClientError || val.HasValidationError || val.HasSystemError { + if err = extractError(val.ErrorMessage); err != nil { + return nil, fmt.Errorf("%s: %w", ErrGetIncludeActivation, err) + } + } + } + if len(result.Activations.Items) == 0 { return nil, fmt.Errorf("%s: %w: ActivationID: %s", ErrGetIncludeActivation, ErrNotFound, params.ActivationID) } @@ -563,3 +574,18 @@ func (p *papi) ListIncludeActivations(ctx context.Context, params ListIncludeAct return &result, nil } + +// extractError extracts error from validation object in GetIncludeActivation response if it is present +func extractError(rawError string) error { + startIndex := strings.Index(rawError, "{") + endIndex := strings.LastIndex(rawError, "}") + 1 + formattedError := rawError[startIndex:endIndex] + + var e ActivationError + + if err := json.Unmarshal([]byte(formattedError), &e); err != nil { + return err + } + + return &e +} diff --git a/pkg/papi/include_activations_test.go b/pkg/papi/include_activations_test.go index a1b59823..e26ed7c3 100644 --- a/pkg/papi/include_activations_test.go +++ b/pkg/papi/include_activations_test.go @@ -814,6 +814,39 @@ func TestGetIncludeActivation(t *testing.T) { }, }, }, + "200 but with activation validation error - ErrMissingComplianceRecord expected": { + params: GetIncludeActivationRequest{ + IncludeID: "inc_12345", + ActivationID: "atv_12345", + }, + expectedPath: "/papi/v1/includes/inc_12345/activations/atv_12345", + responseStatus: http.StatusOK, + responseBody: ` +{ + "accountId": "test_account", + "contractId": "test_contract", + "groupId": "test_group", + "validations": { + "validationSummary": { + "completePercent": 100.0, + "hasValidationError": false, + "hasValidationWarning": false, + "hasSystemError": false, + "hasClientError": true, + "messageState": "HTTP_CLIENT_ERROR", + "errorMessage": "400 : \"{\"type\":\"missing_compliance_record\",\"title\":\"Property Manager Exception\",\"instance\":\"TestInstance\",\"status\":400,\"errors\":[{\"type\":\"missing_compliance_record\",\"title\":\"Property Manager Exception\",\"detail\":\"missing_compliance_record\"}],\"details\":{},\"messageId\":\"missing_compliance_record\",\"params\":[],\"result\":\"ERROR\"}\"" + }, + "validationErrorsItemList": { + "items": [] + }, + "network": "PRODUCTION" + }, + "activations": { + "items": [] + } +}`, + withError: ErrMissingComplianceRecord, + }, "500 internal server error": { params: GetIncludeActivationRequest{ IncludeID: "inc_12345", @@ -1188,3 +1221,54 @@ func TestListIncludeActivations(t *testing.T) { }) } } + +func TestExtractError(t *testing.T) { + tests := map[string]struct { + errorMessage string + wantedError *ActivationError + }{ + "all data": { + errorMessage: "111 : \"{\"type\":\"type1\",\"title\":\"title1\",\"instance\":\"instance1\",\"status\":404,\"errors\":[{\"type\":\"type2\",\"title\":\"title2\",\"detail\":\"detail1\"}],\"details\":{},\"messageId\":\"message1\",\"params\":[],\"result\":\"result1\"}\"", + wantedError: &ActivationError{ + Type: "type1", + Title: "title1", + Instance: "instance1", + Status: 404, + Errors: []ActivationErrorMessage{ + { + Type: "type2", + Title: "title2", + Detail: "detail1", + }, + }, + MessageID: "message1", + Result: "result1", + }, + }, + "minimum data": { + errorMessage: "111 : \"{\"type\":\"type1\",\"title\":\"title1\",\"instance\":\"instance1\",\"status\":404,\"errors\":[{\"type\":\"type2\",\"title\":\"title2\",\"detail\":\"detail1\"}],\"messageId\":\"message1\",\"result\":\"result1\"}\"", + wantedError: &ActivationError{ + Type: "type1", + Title: "title1", + Instance: "instance1", + Status: 404, + Errors: []ActivationErrorMessage{ + { + Type: "type2", + Title: "title2", + Detail: "detail1", + }, + }, + MessageID: "message1", + Result: "result1", + }, + }, + } + + for name, test := range tests { + t.Run(name, func(t *testing.T) { + gotErr := extractError(test.errorMessage) + assert.EqualError(t, test.wantedError, gotErr.Error()) + }) + } +} diff --git a/pkg/papi/include_rule.go b/pkg/papi/include_rule.go index 55683454..82e50fc6 100644 --- a/pkg/papi/include_rule.go +++ b/pkg/papi/include_rule.go @@ -8,7 +8,7 @@ import ( "net/url" "strconv" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/papi/include_rule_test.go b/pkg/papi/include_rule_test.go index ddd2053a..4c85e25b 100644 --- a/pkg/papi/include_rule_test.go +++ b/pkg/papi/include_rule_test.go @@ -8,6 +8,8 @@ import ( "net/http/httptest" "testing" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -183,11 +185,11 @@ func TestGetIncludeRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -356,11 +358,11 @@ func TestGetIncludeRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -560,11 +562,11 @@ func TestUpdateIncludeRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -781,11 +783,11 @@ func TestUpdateIncludeRuleTree(t *testing.T) { TemplateLink: "/platformtoolkit/service/ruletemplate/30582260/1?accountId=1-1TJZFB&gid=61726&ck=16.3.1.1", Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -861,11 +863,11 @@ func TestUpdateIncludeRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -956,11 +958,11 @@ func TestUpdateIncludeRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -1037,11 +1039,11 @@ func TestUpdateIncludeRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -1118,11 +1120,11 @@ func TestUpdateIncludeRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -1199,11 +1201,11 @@ func TestUpdateIncludeRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -1281,11 +1283,11 @@ func TestUpdateIncludeRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, diff --git a/pkg/papi/include_test.go b/pkg/papi/include_test.go index 3f2acb3f..1874851e 100644 --- a/pkg/papi/include_test.go +++ b/pkg/papi/include_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/pkg/papi/include_versions.go b/pkg/papi/include_versions.go index 75ece632..afb6539f 100644 --- a/pkg/papi/include_versions.go +++ b/pkg/papi/include_versions.go @@ -8,7 +8,7 @@ import ( "net/url" "strconv" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/papi/papi.go b/pkg/papi/papi.go index e0722ca6..0854b4ee 100644 --- a/pkg/papi/papi.go +++ b/pkg/papi/papi.go @@ -5,7 +5,7 @@ import ( "errors" "net/http" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/spf13/cast" ) @@ -21,6 +21,9 @@ var ( // ErrDefaultCertLimitReached indicates that the limit for DEFAULT certificates has been reached ErrDefaultCertLimitReached = errors.New("the limit for DEFAULT certificates has been reached") + + // ErrMissingComplianceRecord is returned when compliance record is required and is not provided + ErrMissingComplianceRecord = errors.New("compliance record must be specified") ) type ( diff --git a/pkg/papi/papi_test.go b/pkg/papi/papi_test.go index 5cd34495..7c8b7a13 100644 --- a/pkg/papi/papi_test.go +++ b/pkg/papi/papi_test.go @@ -8,8 +8,8 @@ import ( "net/url" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegrid" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/session" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegrid" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/papi/property.go b/pkg/papi/property.go index 8ab193ca..f770c206 100644 --- a/pkg/papi/property.go +++ b/pkg/papi/property.go @@ -7,7 +7,7 @@ import ( "net/http" "net/url" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/papi/property_test.go b/pkg/papi/property_test.go index 8355ff2d..295cb30e 100644 --- a/pkg/papi/property_test.go +++ b/pkg/papi/property_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/papi/propertyversion.go b/pkg/papi/propertyversion.go index 7097f02f..598aaa1c 100644 --- a/pkg/papi/propertyversion.go +++ b/pkg/papi/propertyversion.go @@ -9,7 +9,7 @@ import ( "net/url" "strconv" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) diff --git a/pkg/papi/propertyversion_test.go b/pkg/papi/propertyversion_test.go index ccd6fa07..bf2c9332 100644 --- a/pkg/papi/propertyversion_test.go +++ b/pkg/papi/propertyversion_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/tools" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/pkg/papi/rule.go b/pkg/papi/rule.go index df00564b..2ef72979 100644 --- a/pkg/papi/rule.go +++ b/pkg/papi/rule.go @@ -7,7 +7,7 @@ import ( "net/http" "regexp" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegriderr" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr" validation "github.com/go-ozzo/ozzo-validation/v4" ) @@ -87,11 +87,11 @@ type ( // RuleVariable represents and entry in variables field from Rule resource RuleVariable struct { - Description string `json:"description,omitempty"` - Hidden bool `json:"hidden"` - Name string `json:"name"` - Sensitive bool `json:"sensitive"` - Value string `json:"value,omitempty"` + Description *string `json:"description"` + Hidden bool `json:"hidden"` + Name string `json:"name"` + Sensitive bool `json:"sensitive"` + Value *string `json:"value"` } // UpdateRulesRequest contains path and query params, as well as request body necessary to perform PUT /rules request @@ -114,25 +114,37 @@ type ( // UpdateRulesResponse contains data returned by performing PUT /rules request UpdateRulesResponse struct { - AccountID string `json:"accountId"` - ContractID string `json:"contractId"` - Comments string `json:"comments,omitempty"` - GroupID string `json:"groupId"` - PropertyID string `json:"propertyId"` - PropertyVersion int `json:"propertyVersion"` - Etag string `json:"etag"` - RuleFormat string `json:"ruleFormat"` - Rules Rules `json:"rules"` - Errors []RuleError `json:"errors"` + AccountID string `json:"accountId"` + ContractID string `json:"contractId"` + Comments string `json:"comments,omitempty"` + GroupID string `json:"groupId"` + PropertyID string `json:"propertyId"` + PropertyVersion int `json:"propertyVersion"` + Etag string `json:"etag"` + RuleFormat string `json:"ruleFormat"` + Rules Rules `json:"rules"` + Errors []RuleError `json:"errors"` + Warnings []RuleWarnings `json:"warnings"` } - // RuleError represents and entry in error field from PUT /rules response body + // RuleError represents an entry in error field from PUT /rules response body RuleError struct { - Type string `json:"type"` - Title string `json:"title"` - Detail string `json:"detail"` - Instance string `json:"instance"` - BehaviorName string `json:"behaviorName"` + Type string `json:"type"` + Title string `json:"title"` + Detail string `json:"detail"` + Instance string `json:"instance"` + BehaviorName string `json:"behaviorName"` + ErrorLocation string `json:"errorLocation"` + } + + // RuleWarnings represents an entry in warning field from PUT /rules response body + RuleWarnings struct { + Title string `json:"title"` + Type string `json:"type"` + ErrorLocation string `json:"errorLocation"` + Detail string `json:"detail"` + CurrentRuleFormat string `json:"currentRuleFormat"` + SuggestedRuleFormat string `json:"suggestedRuleFormat"` } // RuleOptionsMap is a type wrapping map[string]interface{} used for adding rule options @@ -217,7 +229,8 @@ func (co RuleCustomOverride) Validate() error { // Validate validates RuleVariable struct func (v RuleVariable) Validate() error { return validation.Errors{ - "Name": validation.Validate(v.Name, validation.Required), + "Name": validation.Validate(v.Name, validation.Required), + "Value": validation.Validate(v.Value, validation.NotNil), }.Filter() } diff --git a/pkg/papi/rule_test.go b/pkg/papi/rule_test.go index 747c7fb4..c5634839 100644 --- a/pkg/papi/rule_test.go +++ b/pkg/papi/rule_test.go @@ -1,6 +1,7 @@ package papi import ( + "bytes" "context" "errors" "fmt" @@ -8,6 +9,7 @@ import ( "net/http/httptest" "testing" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/tools" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -179,11 +181,11 @@ func TestPapi_GetRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -334,11 +336,11 @@ func TestPapi_GetRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -486,11 +488,11 @@ func TestPapi_GetRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -644,6 +646,7 @@ func TestPapi_GetRuleTree(t *testing.T) { func TestPapi_UpdateRuleTree(t *testing.T) { tests := map[string]struct { params UpdateRulesRequest + requestBody string responseStatus int responseBody string expectedPath string @@ -720,11 +723,11 @@ func TestPapi_UpdateRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -918,11 +921,11 @@ func TestPapi_UpdateRuleTree(t *testing.T) { TemplateLink: "/platformtoolkit/service/ruletemplate/30582260/1?accountId=1-1TJZFB&gid=61726&ck=16.3.1.1", Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -937,6 +940,371 @@ func TestPapi_UpdateRuleTree(t *testing.T) { }, }, }, + "200 OK - empty and null values for description": { + params: UpdateRulesRequest{ + ContractID: "ctr_id", + GroupID: "grp_id", + PropertyID: "prp_id", + PropertyVersion: 1, + Rules: RulesUpdate{ + Comments: "version comment", + Rules: Rules{ + Name: "default", + Children: []Rules{ + { + Name: "change fwd path", + Children: []Rules{}, + Behaviors: []RuleBehavior{ + { + Name: "baseDirectory", + Options: RuleOptionsMap{ + "value": "/smth/", + }, + }, + }, + Criteria: []RuleBehavior{ + { + Name: "requestHeader", + Locked: false, + Options: RuleOptionsMap{ + "headerName": "Accept-Encoding", + "matchCaseSensitiveValue": true, + "matchOperator": "IS_ONE_OF", + "matchWildcardName": false, + "matchWildcardValue": false, + }, + }, + }, + CriteriaMustSatisfy: RuleCriteriaMustSatisfyAll, + }, + { + Name: "caching", + Children: []Rules{}, + Behaviors: []RuleBehavior{ + { + Name: "caching", + Options: RuleOptionsMap{ + "behavior": "MAX_AGE", + "mustRevalidate": false, + "ttl": "1m", + }, + }, + }, + Criteria: []RuleBehavior{}, + CriteriaMustSatisfy: RuleCriteriaMustSatisfyAny, + }, + }, + Behaviors: []RuleBehavior{ + { + Name: "origin", + Options: RuleOptionsMap{ + "cacheKeyHostname": "REQUEST_HOST_HEADER", + "compress": true, + "enableTrueClientIp": true, + "forwardHostHeader": "REQUEST_HOST_HEADER", + "hostname": "httpbin.smth.online", + "httpPort": float64(80), + "httpsPort": float64(443), + "originCertificate": "", + "originSni": true, + "originType": "CUSTOMER", + "ports": "", + "trueClientIpClientSetting": false, + "trueClientIpHeader": "True-Client-IP", + "verificationMode": "PLATFORM_SETTINGS", + }, + }, + }, + Options: RuleOptions{}, + Criteria: []RuleBehavior{}, + Variables: []RuleVariable{ + { + Name: "TEST_EMPTY_FIELDS", + Value: tools.StringPtr(""), + Description: tools.StringPtr(""), + Hidden: true, + Sensitive: false, + }, + { + Name: "TEST_NIL_DESCRIPTION", + Description: nil, + Value: tools.StringPtr(""), + Hidden: true, + Sensitive: false, + }, + }, + Comments: "The behaviors in the Default Rule apply to all requests for the property hostname(s) unless another rule overrides the Default Rule settings.", + }, + }, + }, + requestBody: `{"comments":"version comment","rules":{"behaviors":[{"name":"origin","options":{"cacheKeyHostname":"REQUEST_HOST_HEADER","compress":true,"enableTrueClientIp":true,"forwardHostHeader":"REQUEST_HOST_HEADER","hostname":"httpbin.smth.online","httpPort":80,"httpsPort":443,"originCertificate":"","originSni":true,"originType":"CUSTOMER","ports":"","trueClientIpClientSetting":false,"trueClientIpHeader":"True-Client-IP","verificationMode":"PLATFORM_SETTINGS"}}],"children":[{"behaviors":[{"name":"baseDirectory","options":{"value":"/smth/"}}],"criteria":[{"name":"requestHeader","options":{"headerName":"Accept-Encoding","matchCaseSensitiveValue":true,"matchOperator":"IS_ONE_OF","matchWildcardName":false,"matchWildcardValue":false}}],"name":"change fwd path","options":{},"criteriaMustSatisfy":"all"},{"behaviors":[{"name":"caching","options":{"behavior":"MAX_AGE","mustRevalidate":false,"ttl":"1m"}}],"name":"caching","options":{},"criteriaMustSatisfy":"any"}],"comments":"The behaviors in the Default Rule apply to all requests for the property hostname(s) unless another rule overrides the Default Rule settings.","name":"default","options":{},"variables":[{"description":"","hidden":true,"name":"TEST_EMPTY_FIELDS","sensitive":false,"value":""},{"description":null,"hidden":true,"name":"TEST_NIL_DESCRIPTION","sensitive":false,"value":""}]}}`, + responseStatus: http.StatusOK, + responseBody: `{ + "accountId": "act_id", + "contractId": "ctr_id", + "groupId": "grp_id", + "propertyId": "grp_id", + "propertyName": "dxe-2407-reproducing", + "propertyVersion": 1, + "etag": "123ge123", + "rules": { + "name": "default", + "children": [ + { + "name": "change fwd path", + "children": [], + "behaviors": [ + { + "name": "baseDirectory", + "options": { + "value": "/smth/" + } + } + ], + "criteria": [ + { + "name": "requestHeader", + "options": { + "headerName": "Accept-Encoding", + "matchCaseSensitiveValue": true, + "matchOperator": "IS_ONE_OF", + "matchWildcardName": false, + "matchWildcardValue": false + } + } + ], + "criteriaMustSatisfy": "all" + }, + { + "name": "caching", + "children": [], + "behaviors": [ + { + "name": "caching", + "options": { + "behavior": "MAX_AGE", + "mustRevalidate": false, + "ttl": "1m" + } + } + ], + "criteria": [], + "criteriaMustSatisfy": "any" + } + ], + "behaviors": [ + { + "name": "origin", + "options": { + "cacheKeyHostname": "REQUEST_HOST_HEADER", + "compress": true, + "enableTrueClientIp": true, + "forwardHostHeader": "REQUEST_HOST_HEADER", + "hostname": "httpbin.smth.online", + "httpPort": 80, + "httpsPort": 443, + "originCertificate": "", + "originSni": true, + "originType": "CUSTOMER", + "ports": "", + "trueClientIpClientSetting": false, + "trueClientIpHeader": "True-Client-IP", + "verificationMode": "PLATFORM_SETTINGS" + } + } + ], + "options": {}, + "variables": [ + { + "name": "TEST_EMPTY_FIELDS", + "value": "", + "description": "", + "hidden": true, + "sensitive": false + }, + { + "name": "TEST_NIL_FIELDS", + "value": "", + "description": null, + "hidden": true, + "sensitive": false + } + ], + "comments": "The behaviors in the Default Rule apply to all requests for the property hostname(s) unless another rule overrides the Default Rule settings." + }, + "errors": [ + { + "type": "https://problems.luna.akamaiapis.net/papi/v0/validation/required_feature_any", + "errorLocation": "#/rules", + "detail": "Add a Content Provider Code behavior in any rule. See Content Provider Code." + } + ], + "warnings": [ + { + "type": "https://problems.luna.akamaiapis.net/papi/v0/validation/incompatible_condition", + "errorLocation": "#/rules/children/0/behaviors/0" + }, + { + "title": "Unstable rule format", + "type": "https://problems.luna.akamaiapis.net/papi/v0/unstable_rule_format", + "currentRuleFormat": "latest", + "suggestedRuleFormat": "v2023-01-05" + } + ], + "ruleFormat": "latest" +}`, + expectedPath: "/papi/v1/properties/prp_id/versions/1/rules?contractId=ctr_id&groupId=grp_id&validateRules=false", + expectedResponse: &UpdateRulesResponse{ + AccountID: "act_id", + ContractID: "ctr_id", + GroupID: "grp_id", + PropertyID: "grp_id", + PropertyVersion: 1, + Etag: "123ge123", + RuleFormat: "latest", + Rules: Rules{ + Name: "default", + Children: []Rules{ + { + Name: "change fwd path", + Children: []Rules{}, + Behaviors: []RuleBehavior{ + { + Name: "baseDirectory", + Options: RuleOptionsMap{ + "value": "/smth/", + }, + }, + }, + Criteria: []RuleBehavior{ + { + Name: "requestHeader", + Locked: false, + Options: RuleOptionsMap{ + "headerName": "Accept-Encoding", + "matchCaseSensitiveValue": true, + "matchOperator": "IS_ONE_OF", + "matchWildcardName": false, + "matchWildcardValue": false, + }, + }, + }, + CriteriaMustSatisfy: "all", + }, + { + Name: "caching", + Children: []Rules{}, + Behaviors: []RuleBehavior{ + { + Name: "caching", + Options: RuleOptionsMap{ + "behavior": "MAX_AGE", + "mustRevalidate": false, + "ttl": "1m", + }, + }, + }, + Criteria: []RuleBehavior{}, + CriteriaMustSatisfy: "any", + }, + }, + Behaviors: []RuleBehavior{ + { + Name: "origin", + Options: RuleOptionsMap{ + "cacheKeyHostname": "REQUEST_HOST_HEADER", + "compress": true, + "enableTrueClientIp": true, + "forwardHostHeader": "REQUEST_HOST_HEADER", + "hostname": "httpbin.smth.online", + "httpPort": float64(80), + "httpsPort": float64(443), + "originCertificate": "", + "originSni": true, + "originType": "CUSTOMER", + "ports": "", + "trueClientIpClientSetting": false, + "trueClientIpHeader": "True-Client-IP", + "verificationMode": "PLATFORM_SETTINGS", + }, + }, + }, + Variables: []RuleVariable{ + { + Name: "TEST_EMPTY_FIELDS", + Value: tools.StringPtr(""), + Description: tools.StringPtr(""), + Hidden: true, + Sensitive: false, + }, + { + Name: "TEST_NIL_FIELDS", + Description: nil, + Value: tools.StringPtr(""), + Hidden: true, + Sensitive: false, + }, + }, + Comments: "The behaviors in the Default Rule apply to all requests for the property hostname(s) unless another rule overrides the Default Rule settings.", + }, + Errors: []RuleError{ + { + Type: "https://problems.luna.akamaiapis.net/papi/v0/validation/required_feature_any", + ErrorLocation: "#/rules", + Detail: "Add a Content Provider Code behavior in any rule. See Content Provider Code.", + }, + }, + Warnings: []RuleWarnings{ + { + Type: "https://problems.luna.akamaiapis.net/papi/v0/validation/incompatible_condition", + ErrorLocation: "#/rules/children/0/behaviors/0", + }, + { + Title: "Unstable rule format", + Type: "https://problems.luna.akamaiapis.net/papi/v0/unstable_rule_format", + CurrentRuleFormat: "latest", + SuggestedRuleFormat: "v2023-01-05", + }, + }, + }, + }, + "validation error - value is null": { + params: UpdateRulesRequest{ + ContractID: "ctr_id", + GroupID: "grp_id", + PropertyID: "prp_id", + PropertyVersion: 1, + Rules: RulesUpdate{ + Comments: "version comment", + Rules: Rules{ + Name: "default", + Variables: []RuleVariable{ + { + Name: "TEST_EMPTY_FIELDS", + Value: tools.StringPtr(""), + Description: tools.StringPtr(""), + Hidden: true, + Sensitive: false, + }, + { + Name: "TEST_NIL_FIELDS", + Description: nil, + Value: nil, + Hidden: true, + Sensitive: false, + }, + }, + Comments: "The behaviors in the Default Rule apply to all requests for the property hostname(s) unless another rule overrides the Default Rule settings.", + }, + }, + }, + expectedPath: "/papi/v1/properties/prp_id/versions/1/rules?contractId=ctr_id&groupId=grp_id&validateRules=false", + withError: func(t *testing.T, err error) { + want := ErrStructValidation + assert.True(t, errors.Is(err, want), "want: %s; got: %s", want, err) + assert.Contains(t, err.Error(), "updating rule tree: struct validation:\nVariables[1]: {\n\tValue: is required\n}") + }, + }, "500 Internal Server Error": { params: UpdateRulesRequest{ PropertyID: "propertyID", @@ -1005,11 +1373,11 @@ func TestPapi_UpdateRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -1102,11 +1470,11 @@ func TestPapi_UpdateRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -1185,11 +1553,11 @@ func TestPapi_UpdateRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -1269,11 +1637,11 @@ func TestPapi_UpdateRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -1353,11 +1721,11 @@ func TestPapi_UpdateRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -1437,11 +1805,11 @@ func TestPapi_UpdateRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -1521,11 +1889,11 @@ func TestPapi_UpdateRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "VAR_NAME", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -1605,11 +1973,11 @@ func TestPapi_UpdateRuleTree(t *testing.T) { }, Variables: []RuleVariable{ { - Description: "This is a sample Property Manager variable.", + Description: tools.StringPtr("This is a sample Property Manager variable."), Hidden: false, Name: "", Sensitive: false, - Value: "default value", + Value: tools.StringPtr("default value"), }, }, }, @@ -1628,6 +1996,13 @@ func TestPapi_UpdateRuleTree(t *testing.T) { mockServer := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, test.expectedPath, r.URL.String()) assert.Equal(t, http.MethodPut, r.Method) + if test.requestBody != "" { + buf := new(bytes.Buffer) + _, err := buf.ReadFrom(r.Body) + assert.NoError(t, err) + req := buf.String() + assert.Equal(t, test.requestBody, req) + } w.WriteHeader(test.responseStatus) _, err := w.Write([]byte(test.responseBody)) assert.NoError(t, err) diff --git a/pkg/session/request_test.go b/pkg/session/request_test.go index 3ea54ce8..9fcae2b7 100644 --- a/pkg/session/request_test.go +++ b/pkg/session/request_test.go @@ -9,7 +9,7 @@ import ( "net/url" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegrid" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegrid" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/pkg/session/session.go b/pkg/session/session.go index c992665c..902e39af 100644 --- a/pkg/session/session.go +++ b/pkg/session/session.go @@ -7,7 +7,7 @@ import ( "runtime" "strings" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegrid" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegrid" "github.com/apex/log" "github.com/apex/log/handlers/discard" ) @@ -63,7 +63,7 @@ var ( const ( // Version is the client version - Version = "2.0.0" + Version = "6.0.0" ) // New returns a new session diff --git a/pkg/session/session_test.go b/pkg/session/session_test.go index 0807d84a..5f590786 100644 --- a/pkg/session/session_test.go +++ b/pkg/session/session_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/akamai/AkamaiOPEN-edgegrid-golang/v5/pkg/edgegrid" + "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegrid" "github.com/apex/log" "github.com/apex/log/handlers/discard" "github.com/stretchr/testify/require" @@ -28,7 +28,7 @@ func TestNew(t *testing.T) { signer: &edgegrid.Config{}, log: log.Log, trace: false, - userAgent: "Akamai-Open-Edgegrid-golang/2.0.0 golang/" + strings.TrimPrefix(runtime.Version(), "go"), + userAgent: "Akamai-Open-Edgegrid-golang/6.0.0 golang/" + strings.TrimPrefix(runtime.Version(), "go"), }, }, "with options provided": {