Skip to content

Commit

Permalink
Merge pull request #169 from akamai/release/v2.17.0
Browse files Browse the repository at this point in the history
Release/v2.17.0
  • Loading branch information
mgwoj authored Oct 24, 2022
2 parents 818c939 + e1e0a4e commit a31d03f
Show file tree
Hide file tree
Showing 69 changed files with 1,122 additions and 865 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# EDGEGRID GOLANG RELEASE NOTES

## 2.17.0 (October 24, 2022)

#### FEATURES/ENHANCEMENTS:

* Datastream
* Add ListStreams
* Add new connectors: Elasticsearch, NewRelic and Loggly
* Extend Splunk and Custom HTTPS connectors mTLS certificates configuration
* Extend SumoLogic, Splunk and Custom HTTPS connectors with ability to specify custom HTTP headers

#### BUG FIXES:

* APPSEC
* Fix incorrect JSON sent when applying appsec_ip_geo resource in allow mode

## 2.16.0 (September 26, 2022)

#### FEATURES/ENHANCEMENTS:
Expand Down
23 changes: 9 additions & 14 deletions pkg/appsec/activations.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ func (p *appsec) GetActivations(ctx context.Context, params GetActivationsReques
return nil, fmt.Errorf("%w: %s", ErrStructValidation, err.Error())
}

var result GetActivationsResponse

uri := fmt.Sprintf(
"/appsec/v1/activations/%d",
params.ActivationID)
Expand All @@ -179,9 +177,10 @@ func (p *appsec) GetActivations(ctx context.Context, params GetActivationsReques
return nil, fmt.Errorf("failed to create GetActivations request: %w", err)
}

var result GetActivationsResponse
resp, errp := p.Exec(req, &result)
if errp != nil {
return nil, fmt.Errorf("GetActivations request failed: %w", errp)
return nil, fmt.Errorf("get activations request failed: %w", errp)
}

if resp.StatusCode != http.StatusOK {
Expand All @@ -199,8 +198,6 @@ func (p *appsec) GetActivationHistory(ctx context.Context, params GetActivationH
return nil, fmt.Errorf("%w: %s", ErrStructValidation, err.Error())
}

var result GetActivationHistoryResponse

uri := fmt.Sprintf(
"/appsec/v1/configs/%d/activations",
params.ConfigID)
Expand All @@ -210,9 +207,10 @@ func (p *appsec) GetActivationHistory(ctx context.Context, params GetActivationH
return nil, fmt.Errorf("failed to create GetActivationHistory request: %w", err)
}

resp, errp := p.Exec(req, &result)
if errp != nil {
return nil, fmt.Errorf("list activation history request failed: %w", errp)
var result GetActivationHistoryResponse
resp, err := p.Exec(req, &result)
if err != nil {
return nil, fmt.Errorf("get activation history request failed: %w", err)
}

if resp.StatusCode != http.StatusOK {
Expand All @@ -234,10 +232,9 @@ func (p *appsec) CreateActivations(ctx context.Context, params CreateActivations
}

var result CreateActivationsResponse

resp, err := p.Exec(req, &result, params)
if err != nil {
return nil, fmt.Errorf("CreateActivations request failed: %w", err)
return nil, fmt.Errorf("create activations request failed: %w", err)
}
if resp.StatusCode != http.StatusOK {
return nil, p.Error(resp)
Expand All @@ -255,14 +252,13 @@ func (p *appsec) CreateActivations(ctx context.Context, params CreateActivations

resp, err = p.Exec(req, &result)
if err != nil {
return nil, fmt.Errorf("GetActivation request failed: %w", err)
return nil, fmt.Errorf("get activation request failed: %w", err)
}
if resp.StatusCode != http.StatusOK {
return nil, p.Error(resp)
}

return &result, nil

}

func (p *appsec) RemoveActivations(ctx context.Context, params RemoveActivationsRequest) (*RemoveActivationsResponse, error) {
Expand All @@ -277,10 +273,9 @@ func (p *appsec) RemoveActivations(ctx context.Context, params RemoveActivations
}

var result RemoveActivationsResponse

resp, errp := p.Exec(req, &result, params)
if errp != nil {
return nil, fmt.Errorf("RemoveActivations request failed: %w", errp)
return nil, fmt.Errorf("remove activations request failed: %w", errp)
}
if resp.StatusCode != http.StatusOK {
return nil, p.Error(resp)
Expand Down
22 changes: 12 additions & 10 deletions pkg/appsec/advanced_settings_evasive_path_match.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,13 @@ func (v RemoveAdvancedSettingsEvasivePathMatchRequest) Validate() error {

func (p *appsec) GetAdvancedSettingsEvasivePathMatch(ctx context.Context, params GetAdvancedSettingsEvasivePathMatchRequest) (*GetAdvancedSettingsEvasivePathMatchResponse, error) {
logger := p.Log(ctx)
logger.Debug("GetAdvancedSettingsLoggings")
logger.Debug("GetAdvancedSettingsEvasivePathMatch")

if err := params.Validate(); err != nil {
return nil, fmt.Errorf("%w: %s", ErrStructValidation, err.Error())
}

var result GetAdvancedSettingsEvasivePathMatchResponse
var uri string

if params.PolicyID != "" {
uri = fmt.Sprintf(
"/appsec/v1/configs/%d/versions/%d/security-policies/%s/advanced-settings/evasive-path-match",
Expand All @@ -114,12 +112,13 @@ func (p *appsec) GetAdvancedSettingsEvasivePathMatch(ctx context.Context, params

req, err := http.NewRequestWithContext(ctx, http.MethodGet, uri, nil)
if err != nil {
return nil, fmt.Errorf("failed to create getadvancedsettingsloggings request: %w", err)
return nil, fmt.Errorf("failed to create GetAdvancedSettingsEvasivePathMatch request: %w", err)
}

var result GetAdvancedSettingsEvasivePathMatchResponse
resp, err := p.Exec(req, &result)
if err != nil {
return nil, fmt.Errorf("getadvancedsettingsloggings request failed: %w", err)
return nil, fmt.Errorf("get advanced settings evasive path match request failed: %w", err)
}

if resp.StatusCode != http.StatusOK {
Expand All @@ -131,7 +130,7 @@ func (p *appsec) GetAdvancedSettingsEvasivePathMatch(ctx context.Context, params

func (p *appsec) UpdateAdvancedSettingsEvasivePathMatch(ctx context.Context, params UpdateAdvancedSettingsEvasivePathMatchRequest) (*UpdateAdvancedSettingsEvasivePathMatchResponse, error) {
logger := p.Log(ctx)
logger.Debug("UpdateAdvancedSettingsLogging")
logger.Debug("UpdateAdvancedSettingsEvasivePathMatch")

if err := params.Validate(); err != nil {
return nil, fmt.Errorf("%w: %s", ErrStructValidation, err.Error())
Expand All @@ -153,14 +152,14 @@ func (p *appsec) UpdateAdvancedSettingsEvasivePathMatch(ctx context.Context, par

req, err := http.NewRequestWithContext(ctx, http.MethodPut, uri, nil)
if err != nil {
return nil, fmt.Errorf("failed to create create AdvancedSettingsLoggingrequest: %w", err)
return nil, fmt.Errorf("failed to create UpdateAdvancedSettingsEvasivePathMatch request: %w", err)
}

req.Header.Set("Content-Type", "application/json")

var result UpdateAdvancedSettingsEvasivePathMatchResponse
resp, err := p.Exec(req, &result, params)
if err != nil {
return nil, fmt.Errorf("create AdvancedSettingsLogging request failed: %w", err)
return nil, fmt.Errorf("update advanced settings evasive path match request failed: %w", err)
}

if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
Expand All @@ -171,6 +170,9 @@ func (p *appsec) UpdateAdvancedSettingsEvasivePathMatch(ctx context.Context, par
}

func (p *appsec) RemoveAdvancedSettingsEvasivePathMatch(ctx context.Context, params RemoveAdvancedSettingsEvasivePathMatchRequest) (*RemoveAdvancedSettingsEvasivePathMatchResponse, error) {
logger := p.Log(ctx)
logger.Debug("RemoveAdvancedSettingsEvasivePathMatch")

request := UpdateAdvancedSettingsEvasivePathMatchRequest{
ConfigID: params.ConfigID,
Version: params.Version,
Expand All @@ -179,7 +181,7 @@ func (p *appsec) RemoveAdvancedSettingsEvasivePathMatch(ctx context.Context, par
}
_, err := p.UpdateAdvancedSettingsEvasivePathMatch(ctx, request)
if err != nil {
return nil, fmt.Errorf("UpdateAdvancedSettingsEvasivePathMatch request failed: %w", err)
return nil, fmt.Errorf("remove advanced settings evasive path match request failed: %w", err)
}
response := RemoveAdvancedSettingsEvasivePathMatchResponse{
ConfigID: params.ConfigID,
Expand Down
14 changes: 6 additions & 8 deletions pkg/appsec/advanced_settings_logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ func (p *appsec) GetAdvancedSettingsLogging(ctx context.Context, params GetAdvan
return nil, fmt.Errorf("%w: %s", ErrStructValidation, err.Error())
}

var result GetAdvancedSettingsLoggingResponse
var uri string

if params.PolicyID != "" {
uri = fmt.Sprintf(
"/appsec/v1/configs/%d/versions/%d/security-policies/%s/advanced-settings/logging",
Expand All @@ -173,17 +171,17 @@ func (p *appsec) GetAdvancedSettingsLogging(ctx context.Context, params GetAdvan
return nil, fmt.Errorf("failed to create GetAdvancedSettingsLogging request: %w", err)
}

var result GetAdvancedSettingsLoggingResponse
resp, err := p.Exec(req, &result)
if err != nil {
return nil, fmt.Errorf("GetAdvancedSettingsLogging request failed: %w", err)
return nil, fmt.Errorf("get advanced settings logging request failed: %w", err)
}

if resp.StatusCode != http.StatusOK {
return nil, p.Error(resp)
}

return &result, nil

}

func (p *appsec) UpdateAdvancedSettingsLogging(ctx context.Context, params UpdateAdvancedSettingsLoggingRequest) (*UpdateAdvancedSettingsLoggingResponse, error) {
Expand Down Expand Up @@ -212,12 +210,12 @@ func (p *appsec) UpdateAdvancedSettingsLogging(ctx context.Context, params Updat
if err != nil {
return nil, fmt.Errorf("failed to create UpdateAdvancedSettingsLogging request: %w", err)
}

req.Header.Set("Content-Type", "application/json")

var result UpdateAdvancedSettingsLoggingResponse
resp, err := p.Exec(req, &result, params.JsonPayloadRaw)
if err != nil {
return nil, fmt.Errorf("CreateAdvancedSettingsLogging request failed: %w", err)
return nil, fmt.Errorf("update advanced settings logging request failed: %w", err)
}

if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
Expand Down Expand Up @@ -253,12 +251,12 @@ func (p *appsec) RemoveAdvancedSettingsLogging(ctx context.Context, params Remov
if err != nil {
return nil, fmt.Errorf("failed to create RemoveAdvancedSettingsLogging request: %w", err)
}

req.Header.Set("Content-Type", "application/json")

var result RemoveAdvancedSettingsLoggingResponse
resp, err := p.Exec(req, &result, params)
if err != nil {
return nil, fmt.Errorf("RemoveAdvancedSettingsLogging request failed: %w", err)
return nil, fmt.Errorf("remove advanced settings logging request failed: %w", err)
}

if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
Expand Down
9 changes: 3 additions & 6 deletions pkg/appsec/advanced_settings_pragma_header.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ func (p *appsec) GetAdvancedSettingsPragma(ctx context.Context, params GetAdvanc
return nil, fmt.Errorf("%w: %s", ErrStructValidation, err.Error())
}

var result GetAdvancedSettingsPragmaResponse
var uri string

if params.PolicyID != "" {
uri = fmt.Sprintf(
"/appsec/v1/configs/%d/versions/%d/security-policies/%s/advanced-settings/pragma-header",
Expand All @@ -109,20 +107,19 @@ func (p *appsec) GetAdvancedSettingsPragma(ctx context.Context, params GetAdvanc
if err != nil {
return nil, fmt.Errorf("failed to create GetAdvancedSettingsPragma request: %w", err)
}

req.Header.Set("Content-Type", "application/json")

var result GetAdvancedSettingsPragmaResponse
resp, err := p.Exec(req, &result)
if err != nil {
return nil, fmt.Errorf("GetAdvancedSettingsPragma request failed: %w", err)
return nil, fmt.Errorf("get advanced settings pragma request failed: %w", err)
}

if resp.StatusCode != http.StatusOK {
return nil, p.Error(resp)
}

return &result, nil

}

func (p *appsec) UpdateAdvancedSettingsPragma(ctx context.Context, params UpdateAdvancedSettingsPragmaRequest) (*UpdateAdvancedSettingsPragmaResponse, error) {
Expand Down Expand Up @@ -155,7 +152,7 @@ func (p *appsec) UpdateAdvancedSettingsPragma(ctx context.Context, params Update
var result UpdateAdvancedSettingsPragmaResponse
resp, err := p.Exec(req, &result, params.JsonPayloadRaw)
if err != nil {
return nil, fmt.Errorf("UpdateAdvancedSettingsPragma request failed: %w", err)
return nil, fmt.Errorf("update advanced settings pragma request failed: %w", err)
}

if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
Expand Down
8 changes: 3 additions & 5 deletions pkg/appsec/advanced_settings_prefetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ func (p *appsec) GetAdvancedSettingsPrefetch(ctx context.Context, params GetAdva
return nil, fmt.Errorf("%w: %s", ErrStructValidation, err.Error())
}

var result GetAdvancedSettingsPrefetchResponse

uri := fmt.Sprintf(
"/appsec/v1/configs/%d/versions/%d/advanced-settings/prefetch",
params.ConfigID,
Expand All @@ -106,17 +104,17 @@ func (p *appsec) GetAdvancedSettingsPrefetch(ctx context.Context, params GetAdva
return nil, fmt.Errorf("failed to create GetAdvancedSettingsPrefetch request: %w", err)
}

var result GetAdvancedSettingsPrefetchResponse
resp, err := p.Exec(req, &result)
if err != nil {
return nil, fmt.Errorf("GetAdvancedSettingsPrefetch request failed: %w", err)
return nil, fmt.Errorf("get advanced settings prefetch request failed: %w", err)
}

if resp.StatusCode != http.StatusOK {
return nil, p.Error(resp)
}

return &result, nil

}

func (p *appsec) UpdateAdvancedSettingsPrefetch(ctx context.Context, params UpdateAdvancedSettingsPrefetchRequest) (*UpdateAdvancedSettingsPrefetchResponse, error) {
Expand All @@ -141,7 +139,7 @@ func (p *appsec) UpdateAdvancedSettingsPrefetch(ctx context.Context, params Upda
var result UpdateAdvancedSettingsPrefetchResponse
resp, err := p.Exec(req, &result, params)
if err != nil {
return nil, fmt.Errorf("UpdateAdvancedSettingsPrefetch request failed: %w", err)
return nil, fmt.Errorf("update advanced settings prefetch request failed: %w", err)
}

if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
Expand Down
8 changes: 3 additions & 5 deletions pkg/appsec/api_constraints_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ func (p *appsec) GetAPIConstraintsProtection(ctx context.Context, params GetAPIC
return nil, fmt.Errorf("%w: %s", ErrStructValidation, err.Error())
}

var result GetAPIConstraintsProtectionResponse

uri := fmt.Sprintf(
"/appsec/v1/configs/%d/versions/%d/security-policies/%s/protections",
params.ConfigID,
Expand All @@ -98,17 +96,17 @@ func (p *appsec) GetAPIConstraintsProtection(ctx context.Context, params GetAPIC
return nil, fmt.Errorf("failed to create GetAPIConstraintsProtection request: %w", err)
}

var result GetAPIConstraintsProtectionResponse
resp, err := p.Exec(req, &result)
if err != nil {
return nil, fmt.Errorf("GetAPIConstraintsProtection request failed: %w", err)
return nil, fmt.Errorf("get API constraints protection request failed: %w", err)
}

if resp.StatusCode != http.StatusOK {
return nil, p.Error(resp)
}

return &result, nil

}

func (p *appsec) UpdateAPIConstraintsProtection(ctx context.Context, params UpdateAPIConstraintsProtectionRequest) (*UpdateAPIConstraintsProtectionResponse, error) {
Expand All @@ -134,7 +132,7 @@ func (p *appsec) UpdateAPIConstraintsProtection(ctx context.Context, params Upda
var result UpdateAPIConstraintsProtectionResponse
resp, err := p.Exec(req, &result, params)
if err != nil {
return nil, fmt.Errorf("UpdateAPIConstraintsProtection request failed: %w", err)
return nil, fmt.Errorf("update API constraints protection request failed: %w", err)
}

if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
Expand Down
Loading

0 comments on commit a31d03f

Please sign in to comment.