diff --git a/CHANGELOG.md b/CHANGELOG.md index bd971ba0..38c5567e 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 3.21.2 (Jan 10, 2024) + +- Documentation fixes + + ## 3.21.1 (Jan 8, 2024) - Documentation fixes diff --git a/GNUmakefile b/GNUmakefile index a0f9aeb4..811d2b22 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -6,7 +6,7 @@ NAMESPACE=terraform-providers PKG_NAME=incapsula BINARY=terraform-provider-${PKG_NAME} # Whenever bumping provider version, please update the version in incapsula/client.go (line 27) as well. -VERSION=3.21.1 +VERSION=3.21.2 # Mac Intel Chip OS_ARCH=darwin_amd64 diff --git a/incapsula/client.go b/incapsula/client.go index 5559e8a2..b15ff4f0 100644 --- a/incapsula/client.go +++ b/incapsula/client.go @@ -34,7 +34,7 @@ type Client struct { func NewClient(config *Config) *Client { client := &http.Client{} - return &Client{config: config, httpClient: client, providerVersion: "3.21.1"} + return &Client{config: config, httpClient: client, providerVersion: "3.21.2"} } func (c *Client) CreateFormDataBody(bodyMap map[string]interface{}) ([]byte, string) { diff --git a/incapsula/config_test.go b/incapsula/config_test.go index adac30ac..c74c072a 100644 --- a/incapsula/config_test.go +++ b/incapsula/config_test.go @@ -52,7 +52,18 @@ func TestMissingBaseURL(t *testing.T) { } func TestMissingBaseURLRev2(t *testing.T) { - config := Config{APIID: "foo", APIKey: "bar", BaseURL: "foobar.com", BaseURLRev2: ""} + config := Config{APIID: "foo", APIKey: "bar", BaseURL: "foobar.com", BaseURLRev2: "", BaseURLRev3: "foobar.com"} + client, err := config.Client() + if err == nil { + t.Errorf("Should have received an error, got a client: %q", client) + } + if err.Error() != missingBaseURLRev2Message { + t.Errorf("Should have received missing Base URL Revision 2 message, got: %s", err) + } +} + +func TestMissingBaseURLRev3(t *testing.T) { + config := Config{APIID: "foo", APIKey: "bar", BaseURL: "foobar.com", BaseURLRev2: "foobar.com", BaseURLRev3: ""} client, err := config.Client() if err == nil { t.Errorf("Should have received an error, got a client: %q", client) @@ -63,7 +74,7 @@ func TestMissingBaseURLRev2(t *testing.T) { } func TestMissingBaseURLAPI(t *testing.T) { - config := Config{APIID: "foo", APIKey: "bar", BaseURL: "foobar.com", BaseURLRev2: "foobar.com", BaseURLAPI: ""} + config := Config{APIID: "foo", APIKey: "bar", BaseURL: "foobar.com", BaseURLRev2: "foobar.com", BaseURLRev3: "foobar.com", BaseURLAPI: ""} client, err := config.Client() if err == nil { t.Errorf("Should have received an error, got a client: %q", client) @@ -82,7 +93,7 @@ func TestInvalidCredentials(t *testing.T) { })) defer server.Close() - config := Config{APIID: "bad", APIKey: "bad", BaseURL: server.URL, BaseURLRev2: server.URL, BaseURLAPI: server.URL} + config := Config{APIID: "bad", APIKey: "bad", BaseURL: server.URL, BaseURLRev2: server.URL, BaseURLRev3: server.URL, BaseURLAPI: server.URL} client, err := config.Client() if err == nil { t.Errorf("Should have received an error, got a client: %q", client) @@ -101,7 +112,7 @@ func TestValidCredentials(t *testing.T) { })) defer server.Close() - config := Config{APIID: "good", APIKey: "good", BaseURL: server.URL, BaseURLRev2: server.URL, BaseURLAPI: server.URL} + config := Config{APIID: "good", APIKey: "good", BaseURL: server.URL, BaseURLRev2: server.URL, BaseURLRev3: server.URL, BaseURLAPI: server.URL} client, err := config.Client() if err != nil { t.Errorf("Should not have received an error, got: %s", err)