Skip to content

Commit

Permalink
Merge pull request #130 from akamai/release/v2.4.1
Browse files Browse the repository at this point in the history
Release/v2.4.1
  • Loading branch information
robertolopezlopez committed Apr 19, 2021
2 parents cce50e9 + b14f508 commit 518fdb7
Show file tree
Hide file tree
Showing 20 changed files with 283 additions and 390 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# EDGEGRID GOLANG RELEASE NOTES

## 2.4.1 (Apr 19, 2021)

#### BUG FIXES

* APPSEC
* Suppress 'null' text on output of empty/false values
* Prevent configuration drift when reapplying configuration after importing or creating resources

## 2.4.0 (Mar 29, 2021) PAPI - Secure by default

*PAPI
* Support to provision default certs as part of hostnames request
* New cert status object in hostnames response if it exists
Expand Down
4 changes: 2 additions & 2 deletions pkg/appsec/activations.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (p *appsec) CreateActivations(ctx context.Context, params CreateActivations

var rval CreateActivationsResponse

resp, err := p.Exec(req, &rval, params)
_, err = p.Exec(req, &rval, params)
if err != nil {
return nil, fmt.Errorf("create activationrequest failed: %w", err)
}
Expand All @@ -202,7 +202,7 @@ func (p *appsec) CreateActivations(ctx context.Context, params CreateActivations
return nil, fmt.Errorf("failed to get activation request: %w", err)
}

resp, err = p.Exec(req, &rvalget)
resp, err := p.Exec(req, &rvalget)
if err != nil {
return nil, fmt.Errorf("get activation request failed: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/appsec/advanced_settings_logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type (
}

GetAdvancedSettingsLoggingResponse struct {
Override bool `json:"override"`
Override json.RawMessage `json:"override,omitempty"`
AllowSampling bool `json:"allowSampling"`
Cookies *AdvancedSettingsCookies `json:"cookies,omitempty"`
CustomHeaders *AdvancedSettingsCustomHeaders `json:"customHeaders,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions pkg/appsec/api_request_constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type (
}

GetApiRequestConstraintsResponse struct {
APIEndpoints []ApiEndpoint `json:"apiEndpoints,omitEmpty"`
APIEndpoints []ApiEndpoint `json:"apiEndpoints,omitempty"`
}

ApiEndpoint struct {
Expand Down Expand Up @@ -233,7 +233,7 @@ func (p *appsec) RemoveApiRequestConstraints(ctx context.Context, params RemoveA
var rval RemoveApiRequestConstraintsResponse
resp, err := p.Exec(req, &rval, params)
if err != nil {
return nil, fmt.Errorf("Remove ApiRequestConstraints request failed: %w", err)
return nil, fmt.Errorf("remove ApiRequestConstraints request failed: %w", err)
}

if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
Expand Down
1 change: 0 additions & 1 deletion pkg/appsec/appsec.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ type (

appsec struct {
session.Session
usePrefixes bool
}

// Option defines a PAPI option
Expand Down
14 changes: 0 additions & 14 deletions pkg/appsec/appsec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,6 @@ func dummyOpt() Option {
}
}

func loadTestData(name string) ([]byte, error) {
data, err := ioutil.ReadFile(fmt.Sprintf("./testdata/%s", name))
if err != nil {
return nil, err
}

return data, nil
}

// loadFixtureBytes returns the entire contents of the given file as a byte slice
func loadFixtureBytes(path string) []byte {
contents, err := ioutil.ReadFile(path)
Expand All @@ -59,11 +50,6 @@ func loadFixtureBytes(path string) []byte {
return contents
}

// loadFixtureString returns the entire contents of the given file as a string
func loadFixtureString(path string) string {
return string(loadFixtureBytes(path))
}

// compactJSON converts a JSON-encoded byte slice to a compact form (so our JSON fixtures can be readable)
func compactJSON(encoded []byte) string {
buf := bytes.Buffer{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/appsec/bypass_network_lists.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (p *appsec) RemoveBypassNetworkLists(ctx context.Context, params RemoveBypa
var rval RemoveBypassNetworkListsResponse
resp, err := p.Exec(req, &rval, params)
if err != nil {
return nil, fmt.Errorf("Remove BypassNetworkLists request failed: %w", err)
return nil, fmt.Errorf("remove BypassNetworkLists request failed: %w", err)
}

if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated {
Expand Down
4 changes: 1 addition & 3 deletions pkg/appsec/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,7 @@ func (p *appsec) GetConfigurations(ctx context.Context, params GetConfigurations

var rval GetConfigurationsResponse

uri := fmt.Sprintf(
"/appsec/v1/configs",
)
uri := "/appsec/v1/configs"

req, err := http.NewRequestWithContext(ctx, http.MethodGet, uri, nil)
if err != nil {
Expand Down
16 changes: 8 additions & 8 deletions pkg/appsec/custom_deny.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ type (
GetCustomDenyResponse struct {
Description string `json:"description,omitempty"`
Name string `json:"name"`
ID customDenyID `json:"id"`
ID customDenyID `json:"-"`
Parameters []struct {
DisplayName string `json:"displayName"`
DisplayName string `json:"-"`
Name string `json:"name"`
Value string `json:"value"`
} `json:"parameters"`
Expand All @@ -51,7 +51,7 @@ type (
Name string `json:"name"`
ID customDenyID `json:"id"`
Parameters []struct {
DisplayName string `json:"displayName"`
DisplayName string `json:"-"`
Name string `json:"name"`
Value string `json:"value"`
} `json:"parameters"`
Expand All @@ -77,11 +77,11 @@ type (
}

CreateCustomDenyResponse struct {
Description string `json:"description"`
Description string `json:"description,omitempty"`
Name string `json:"name"`
ID customDenyID `json:"id"`
Parameters []struct {
DisplayName string `json:"displayName"`
DisplayName string `json:"-"`
Name string `json:"name"`
Value string `json:"value"`
} `json:"parameters"`
Expand All @@ -95,11 +95,11 @@ type (
}

UpdateCustomDenyResponse struct {
Description string `json:"description"`
Description string `json:"description,omitempty"`
Name string `json:"name"`
ID customDenyID `json:"id"`
ID customDenyID `json:"-"`
Parameters []struct {
DisplayName string `json:"displayName"`
DisplayName string `json:"-"`
Name string `json:"name"`
Value string `json:"value"`
} `json:"parameters"`
Expand Down
64 changes: 32 additions & 32 deletions pkg/appsec/custom_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ type (
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Version int `json:"version,omitempty"`
Version int `json:"-"`
RuleActivated bool `json:"ruleActivated,omitempty"`
Tag []string `json:"tag,omitempty"`
Conditions []struct {
Type string `json:"type,omitempty"`
PositiveMatch bool `json:"positiveMatch"`
Value *json.RawMessage `json:"value,omitempty"`
ValueWildcard bool `json:"valueWildcard,omitempty"`
ValueCase bool `json:"valueCase"`
NameWildcard bool `json:"nameWildcard,omitempty"`
ValueWildcard *json.RawMessage `json:"valueWildcard,omitempty"`
ValueCase *json.RawMessage `json:"valueCase"`
NameWildcard *json.RawMessage `json:"nameWildcard,omitempty"`
Name *json.RawMessage `json:"name,omitempty"`
NameCase bool `json:"nameCase"`
NameCase *json.RawMessage `json:"nameCase"`
} `json:"conditions,omitempty"`
}

Expand All @@ -64,22 +64,22 @@ type (
}

GetCustomRuleResponse struct {
ID int `json:"id,omitempty"`
ID int `json:"-"`
Name string `json:"name"`
Description string `json:"description"`
Version int `json:"version,omitempty"`
RuleActivated bool `json:"ruleActivated"`
Structured bool `json:"structured,omitempty"`
Description string `json:"description,omitempty"`
Version int `json:"-"`
RuleActivated bool `json:"-"`
Structured bool `json:"-"`
Tag []string `json:"tag"`
Conditions []struct {
Type string `json:"type"`
PositiveMatch bool `json:"positiveMatch"`
Value *json.RawMessage `json:"value,omitempty"`
ValueWildcard bool `json:"valueWildcard,omitempty"`
ValueCase bool `json:"valueCase,omitempty"`
NameWildcard bool `json:"nameWildcard,omitempty"`
ValueWildcard *json.RawMessage `json:"valueWildcard,omitempty"`
ValueCase *json.RawMessage `json:"valueCase,omitempty"`
NameWildcard *json.RawMessage `json:"nameWildcard,omitempty"`
Name *json.RawMessage `json:"name,omitempty"`
NameCase bool `json:"nameCase,omitempty"`
NameCase *json.RawMessage `json:"nameCase,omitempty"`
} `json:"conditions"`
}

Expand Down Expand Up @@ -112,19 +112,19 @@ type (
CreateCustomRuleResponse struct {
ID int `json:"id,omitempty"`
Name string `json:"name"`
Description string `json:"description"`
Version int `json:"version,omitempty"`
Description string `json:"description,omitempty"`
Version int `json:"-"`
RuleActivated bool `json:"ruleActivated"`
Tag []string `json:"tag"`
Conditions []struct {
Type string `json:"type"`
PositiveMatch bool `json:"positiveMatch"`
Value CustomRuleConditionsValue `json:"value,omitempty"`
ValueWildcard bool `json:"valueWildcard,omitempty"`
ValueCase bool `json:"valueCase,omitempty"`
NameWildcard bool `json:"nameWildcard,omitempty"`
ValueWildcard *json.RawMessage `json:"valueWildcard,omitempty"`
ValueCase *json.RawMessage `json:"valueCase,omitempty"`
NameWildcard *json.RawMessage `json:"nameWildcard,omitempty"`
Name CustomRuleConditionsName `json:"name,omitempty"`
NameCase bool `json:"nameCase,omitempty"`
NameCase *json.RawMessage `json:"nameCase,omitempty"`
} `json:"conditions"`
}

Expand All @@ -138,19 +138,19 @@ type (
UpdateCustomRuleResponse struct {
ID int `json:"id,omitempty"`
Name string `json:"name"`
Description string `json:"description"`
Version int `json:"version,omitempty"`
Description string `json:"description,omitempty"`
Version int `json:"-"`
RuleActivated bool `json:"ruleActivated"`
Tag []string `json:"tag"`
Conditions []struct {
Type string `json:"type"`
PositiveMatch bool `json:"positiveMatch"`
Value *json.RawMessage `json:"value,omitempty"`
ValueWildcard bool `json:"valueWildcard,omitempty"`
ValueCase bool `json:"valueCase,omitempty"`
NameWildcard bool `json:"nameWildcard,omitempty"`
ValueWildcard *json.RawMessage `json:"valueWildcard,omitempty"`
ValueCase *json.RawMessage `json:"valueCase,omitempty"`
NameWildcard *json.RawMessage `json:"nameWildcard,omitempty"`
Name *json.RawMessage `json:"name,omitempty"`
NameCase bool `json:"nameCase,omitempty"`
NameCase *json.RawMessage `json:"nameCase,omitempty"`
} `json:"conditions"`
}

Expand All @@ -162,19 +162,19 @@ type (
RemoveCustomRuleResponse struct {
ID int `json:"id,omitempty"`
Name string `json:"name"`
Description string `json:"description"`
Version int `json:"version,omitempty"`
Description string `json:"description,omitempty"`
Version int `json:"-"`
RuleActivated bool `json:"ruleActivated"`
Tag []string `json:"tag"`
Conditions []struct {
Type string `json:"type"`
PositiveMatch bool `json:"positiveMatch"`
Value CustomRuleConditionsValue `json:"value,omitempty"`
ValueWildcard bool `json:"valueWildcard,omitempty"`
ValueCase bool `json:"valueCase,omitempty"`
NameWildcard bool `json:"nameWildcard,omitempty"`
ValueWildcard *json.RawMessage `json:"valueWildcard,omitempty"`
ValueCase *json.RawMessage `json:"valueCase,omitempty"`
NameWildcard *json.RawMessage `json:"nameWildcard,omitempty"`
Name CustomRuleConditionsName `json:"name,omitempty"`
NameCase bool `json:"nameCase,omitempty"`
NameCase *json.RawMessage `json:"nameCase,omitempty"`
} `json:"conditions"`
}
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/appsec/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ func (p *appsec) Error(r *http.Response) error {
if err != nil {
p.Log(r.Request.Context()).Errorf("reading error response body: %s", err)
e.StatusCode = r.StatusCode
e.Title = fmt.Sprintf("Failed to read error body")
e.Title = "Failed to read error body"
e.Detail = err.Error()
return &e
}

if err := json.Unmarshal(body, &e); err != nil {
p.Log(r.Request.Context()).Errorf("could not unmarshal API error: %s", err)
e.Title = fmt.Sprintf("Failed to unmarshal error body")
e.Title = "Failed to unmarshal error body"
e.Detail = err.Error()
}

Expand Down
10 changes: 3 additions & 7 deletions pkg/appsec/eval_protect_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ type (
Version int `json:"-"`
}
GetEvalProtectHostResponse struct {
HostnameList []struct {
Hostname string `json:"hostname"`
} `json:"hostnameList"`
Hostnames []string `json:"hostnames"`
}

GetEvalProtectHostsRequest struct {
Expand All @@ -42,9 +40,7 @@ type (
}

GetEvalProtectHostsResponse struct {
HostnameList []struct {
Hostname string `json:"hostname"`
} `json:"hostnameList"`
Hostnames []string `json:"hostnames"`
}

UpdateEvalProtectHostRequest struct {
Expand All @@ -63,7 +59,7 @@ type (
ConfigID int `json:"-"`
Version int `json:"-"`
}
emoveEvalProtectHostResponse struct {
RemoveEvalProtectHostResponse struct {
Action string `json:"action"`
}
)
Expand Down
Loading

0 comments on commit 518fdb7

Please sign in to comment.