Skip to content

Commit 84ea595

Browse files
authored
DXE-2732 Merge pull request #188 from akamai/release/v7.0.0
DXE-2732 Release/v7.0.0
2 parents 80c0192 + 976af2d commit 84ea595

File tree

201 files changed

+2221
-1522
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

201 files changed

+2221
-1522
lines changed

.github/workflows/checks.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- v3
1111
- v4
1212
- v5
13+
- v6
1314
- master
1415
jobs:
1516
test:

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# EDGEGRID GOLANG RELEASE NOTES
22

3+
## 7.0.0 (June 20, 2023)
4+
5+
### BREAKING CHANGES:
6+
7+
* DataStream
8+
* Updated `connectors` details in DataStream 2 API v2.
9+
* Updated `GetProperties` and `GetDatasetFields` methods in DataStream 2 API v2.
10+
* Updated `CreateStream`, `GetStream`, `UpdateStream`, `DeleteStream` and `ListStreams` methods in DataStream 2 API v2.
11+
* Updated `Activate`, `Deactivate`, `ActivationHistory` and `Stream` details in DataStream 2 API v2 and also changed their corresponding response objects.
12+
13+
### FEATURES/ENHANCEMENTS:
14+
15+
* APPSEC
16+
* Update Geo control to include Action for Ukraine.
17+
* Add `AdvancedSettingsPIILearning` interface to support reading and updating the PII learning setting.
18+
19+
### BUG FIXES:
20+
21+
* APPSEC
22+
* Add error handling for failed NetworkList client calls.
23+
324
## 6.0.0 (May 23, 2023)
425

526
### BREAKING CHANGES:

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# Akamai OPEN EdgeGrid for GoLang v6
1+
# Akamai OPEN EdgeGrid for GoLang v7
22

33
![Build Status](https://github.com/akamai/akamaiOPEN-edgegrid-golang/actions/workflows/checks.yml/badge.svg)
4-
[![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)
4+
[![Go Report Card](https://goreportcard.com/badge/github.com/akamai/AkamaiOPEN-edgegrid-golang/v7)](https://goreportcard.com/report/github.com/akamai/AkamaiOPEN-edgegrid-golang/v7)
55
![GitHub release (latest by date)](https://img.shields.io/github/v/release/akamai/akamaiOPEN-edgegrid-golang)
66
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7-
[![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)
7+
[![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/v7)
88

99
This module is presently in active development and provides Akamai REST API support for the Akamai Terraform Provider.
1010

1111
## Backward Compatibility
1212

1313
This module is not backward compatible with the version `v1`.
1414

15-
Originally branch `master` was representing version `v1`. Now it is representing the latest version `v6` and
15+
Originally branch `master` was representing version `v1`. Now it is representing the latest version `v7` and
1616
version `v1`
1717
was moved to dedicated `v1` branch.
1818

@@ -23,6 +23,6 @@ The packages of library can be imported alongside the `v1` library versions with
2323
```
2424
import (
2525
papiv1 "github.com/akamai/AkamaiOPEN-edgegrid-golang/papi-v1"
26-
papi "github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/papi"
26+
papi "github.com/akamai/AkamaiOPEN-edgegrid-golang/v7/pkg/papi"
2727
)
2828
```

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/akamai/AkamaiOPEN-edgegrid-golang/v6
1+
module github.com/akamai/AkamaiOPEN-edgegrid-golang/v7
22

33
go 1.18
44

pkg/appsec/activations_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"net/http/httptest"
99
"testing"
1010

11-
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session"
11+
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v7/pkg/session"
1212
"github.com/stretchr/testify/assert"
1313
"github.com/stretchr/testify/require"
1414
)

pkg/appsec/advanced_settings_attack_payload_logging.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"fmt"
77
"net/http"
88

9-
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/edgegriderr"
9+
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v7/pkg/edgegriderr"
1010
validation "github.com/go-ozzo/ozzo-validation/v4"
1111
)
1212

pkg/appsec/advanced_settings_attack_payload_logging_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"net/http/httptest"
99
"testing"
1010

11-
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session"
11+
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v7/pkg/session"
1212
"github.com/stretchr/testify/assert"
1313
"github.com/stretchr/testify/require"
1414
)

pkg/appsec/advanced_settings_evasive_path_match_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"net/http/httptest"
99
"testing"
1010

11-
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session"
11+
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v7/pkg/session"
1212
"github.com/stretchr/testify/assert"
1313
"github.com/stretchr/testify/require"
1414
)

pkg/appsec/advanced_settings_logging_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"net/http/httptest"
99
"testing"
1010

11-
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v6/pkg/session"
11+
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v7/pkg/session"
1212
"github.com/stretchr/testify/assert"
1313
"github.com/stretchr/testify/require"
1414
)
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
package appsec
2+
3+
import (
4+
"context"
5+
"fmt"
6+
"net/http"
7+
8+
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v7/pkg/edgegriderr"
9+
validation "github.com/go-ozzo/ozzo-validation/v4"
10+
)
11+
12+
type (
13+
// The AdvancedSettingsPIILearning interface supports retrieving or modifying the PII Learning setting.
14+
AdvancedSettingsPIILearning interface {
15+
// GetAdvancedSettingsPIILearning retrieves the PII Learning setting.
16+
//
17+
// See: https://techdocs.akamai.com/application-security/reference/get-pii-learning
18+
GetAdvancedSettingsPIILearning(ctx context.Context, params GetAdvancedSettingsPIILearningRequest) (*AdvancedSettingsPIILearningResponse, error)
19+
20+
// UpdateAdvancedSettingsPIILearning modifies the PII Learning setting.
21+
//
22+
// See: https://techdocs.akamai.com/application-security/reference/put-pii-learning
23+
UpdateAdvancedSettingsPIILearning(ctx context.Context, params UpdateAdvancedSettingsPIILearningRequest) (*AdvancedSettingsPIILearningResponse, error)
24+
}
25+
26+
// ConfigVersion is used to specify a security configuration and version.
27+
ConfigVersion struct {
28+
ConfigID int64
29+
Version int
30+
}
31+
32+
// GetAdvancedSettingsPIILearningRequest is used to retrieve the PIILearning setting.
33+
GetAdvancedSettingsPIILearningRequest struct {
34+
ConfigVersion
35+
}
36+
37+
// UpdateAdvancedSettingsPIILearningRequest is used to update the PIILearning setting.
38+
UpdateAdvancedSettingsPIILearningRequest struct {
39+
ConfigVersion
40+
EnablePIILearning bool `json:"enablePiiLearning"`
41+
}
42+
43+
// AdvancedSettingsPIILearningResponse returns the result of updating the PIILearning setting
44+
AdvancedSettingsPIILearningResponse struct {
45+
EnablePIILearning bool `json:"enablePiiLearning"`
46+
}
47+
)
48+
49+
// Validate validates GetAdvancedSettingssPIILearningRequest
50+
func (v GetAdvancedSettingsPIILearningRequest) Validate() error {
51+
return edgegriderr.ParseValidationErrors(validation.Errors{
52+
"ConfigID": validation.Validate(v.ConfigID, validation.Required),
53+
"Version": validation.Validate(v.Version, validation.Required),
54+
})
55+
}
56+
57+
// Validate validates UpdateAdvancedSettingsPIILearningRequest
58+
func (v UpdateAdvancedSettingsPIILearningRequest) Validate() error {
59+
return edgegriderr.ParseValidationErrors(validation.Errors{
60+
"ConfigID": validation.Validate(v.ConfigID, validation.Required),
61+
"Version": validation.Validate(v.Version, validation.Required),
62+
})
63+
}
64+
65+
func (p *appsec) GetAdvancedSettingsPIILearning(ctx context.Context, params GetAdvancedSettingsPIILearningRequest) (*AdvancedSettingsPIILearningResponse, error) {
66+
logger := p.Log(ctx)
67+
logger.Debug("GetAdvancedSettingsPIILearning")
68+
69+
if err := params.Validate(); err != nil {
70+
return nil, fmt.Errorf("%w: %s", ErrStructValidation, err.Error())
71+
}
72+
73+
uri := fmt.Sprintf(
74+
"/appsec/v1/configs/%d/versions/%d/advanced-settings/pii-learning",
75+
params.ConfigID,
76+
params.Version)
77+
78+
req, err := http.NewRequestWithContext(ctx, http.MethodGet, uri, nil)
79+
if err != nil {
80+
return nil, fmt.Errorf("%w: %s", ErrRequestCreation, err.Error())
81+
}
82+
83+
var result AdvancedSettingsPIILearningResponse
84+
resp, err := p.Exec(req, &result)
85+
if err != nil {
86+
return nil, fmt.Errorf("%w: %s", ErrAPICallFailure, err.Error())
87+
}
88+
89+
if resp.StatusCode != http.StatusOK {
90+
return nil, p.Error(resp)
91+
}
92+
93+
return &result, nil
94+
}
95+
96+
func (p *appsec) UpdateAdvancedSettingsPIILearning(ctx context.Context, params UpdateAdvancedSettingsPIILearningRequest) (*AdvancedSettingsPIILearningResponse, error) {
97+
logger := p.Log(ctx)
98+
logger.Debug("UpdateAdvancedSettingsPIILearning")
99+
100+
if err := params.Validate(); err != nil {
101+
return nil, fmt.Errorf("%w: %s", ErrStructValidation, err.Error())
102+
}
103+
104+
uri := fmt.Sprintf(
105+
"/appsec/v1/configs/%d/versions/%d/advanced-settings/pii-learning",
106+
params.ConfigID,
107+
params.Version)
108+
109+
req, err := http.NewRequestWithContext(ctx, http.MethodPut, uri, nil)
110+
if err != nil {
111+
return nil, fmt.Errorf("%w: %s", ErrRequestCreation, err.Error())
112+
}
113+
114+
var result AdvancedSettingsPIILearningResponse
115+
resp, err := p.Exec(req, &result, struct {
116+
EnablePIILearning bool `json:"enablePiiLearning"`
117+
}{
118+
EnablePIILearning: params.EnablePIILearning})
119+
if err != nil {
120+
return nil, fmt.Errorf("%w: %s", ErrAPICallFailure, err.Error())
121+
}
122+
123+
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
124+
return nil, p.Error(resp)
125+
}
126+
127+
return &result, nil
128+
}

0 commit comments

Comments
 (0)