diff --git a/cmd/ddosx/ddosx.go b/cmd/ddosx/ddosx.go index f5adfb3..8138c1f 100644 --- a/cmd/ddosx/ddosx.go +++ b/cmd/ddosx/ddosx.go @@ -16,6 +16,7 @@ func DDoSXRootCmd(f factory.ClientFactory, fs afero.Fs) *cobra.Command { cmd.AddCommand(ddosxDomainRootCmd(f, fs)) cmd.AddCommand(ddosxRecordRootCmd(f)) cmd.AddCommand(ddosxSSLRootCmd(f, fs)) + cmd.AddCommand(ddosxWAFRootCmd(f)) return cmd } diff --git a/cmd/ddosx/ddosx_waf.go b/cmd/ddosx/ddosx_waf.go new file mode 100644 index 0000000..1fe683e --- /dev/null +++ b/cmd/ddosx/ddosx_waf.go @@ -0,0 +1,18 @@ +package ddosx + +import ( + "github.com/spf13/cobra" + "github.com/ukfast/cli/internal/pkg/factory" +) + +func ddosxWAFRootCmd(f factory.ClientFactory) *cobra.Command { + cmd := &cobra.Command{ + Use: "waf", + Short: "sub-commands relating to web application filewalls", + } + + // Child root commands + cmd.AddCommand(ddosxWAFLogRootCmd(f)) + + return cmd +} diff --git a/cmd/ddosx/ddosx_waf_log.go b/cmd/ddosx/ddosx_waf_log.go new file mode 100644 index 0000000..143e201 --- /dev/null +++ b/cmd/ddosx/ddosx_waf_log.go @@ -0,0 +1,108 @@ +package ddosx + +import ( + "errors" + "fmt" + + "github.com/spf13/cobra" + "github.com/ukfast/cli/internal/pkg/factory" + "github.com/ukfast/cli/internal/pkg/helper" + "github.com/ukfast/cli/internal/pkg/output" + "github.com/ukfast/sdk-go/pkg/service/ddosx" +) + +func ddosxWAFLogRootCmd(f factory.ClientFactory) *cobra.Command { + cmd := &cobra.Command{ + Use: "log", + Short: "sub-commands relating to domain web application firewall logs", + } + + // Child root commands + cmd.AddCommand(ddosxWAFLogMatchRootCmd(f)) + + // Child commands + cmd.AddCommand(ddosxWAFLogListCmd(f)) + cmd.AddCommand(ddosxWAFLogShowCmd(f)) + + return cmd +} + +func ddosxWAFLogListCmd(f factory.ClientFactory) *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "Lists WAF logs", + Long: "This command lists WAF logs", + Example: "ukfast ddosx waf log list", + RunE: func(cmd *cobra.Command, args []string) error { + c, err := f.NewClient() + if err != nil { + return err + } + + return ddosxWAFLogList(c.DDoSXService(), cmd, args) + }, + } + + cmd.Flags().String("domain", "", "Domain name for filtering") + + return cmd +} + +func ddosxWAFLogList(service ddosx.DDoSXService, cmd *cobra.Command, args []string) error { + params, err := helper.GetAPIRequestParametersFromFlags(cmd) + if err != nil { + return err + } + + if cmd.Flags().Changed("domain") { + filterDomain, _ := cmd.Flags().GetString("domain") + params.WithFilter(helper.GetFilteringInferOperator("domain", filterDomain)) + } + + logs, err := service.GetWAFLogs(params) + if err != nil { + return fmt.Errorf("Error retrieving WAF logs: %s", err) + } + + return output.CommandOutput(cmd, OutputDDoSXWAFLogsProvider(logs)) +} + +func ddosxWAFLogShowCmd(f factory.ClientFactory) *cobra.Command { + return &cobra.Command{ + Use: "show ...", + Short: "Shows WAF logs", + Long: "This command shows a WAF log", + Example: "ukfast ddosx waf log show 2d8556677081cecf112b555c359a78c6", + Args: func(cmd *cobra.Command, args []string) error { + if len(args) < 1 { + return errors.New("Missing request") + } + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + c, err := f.NewClient() + if err != nil { + return err + } + + return ddosxWAFLogShow(c.DDoSXService(), cmd, args) + }, + } +} + +func ddosxWAFLogShow(service ddosx.DDoSXService, cmd *cobra.Command, args []string) error { + var logs []ddosx.WAFLog + + for _, arg := range args { + log, err := service.GetWAFLog(arg) + if err != nil { + output.OutputWithErrorLevelf("Error retrieving WAF log [%s]: %s", arg, err.Error()) + continue + } + + logs = append(logs, log) + } + + return output.CommandOutput(cmd, OutputDDoSXWAFLogsProvider(logs)) +} diff --git a/cmd/ddosx/ddosx_waf_log_match.go b/cmd/ddosx/ddosx_waf_log_match.go new file mode 100644 index 0000000..5d82c10 --- /dev/null +++ b/cmd/ddosx/ddosx_waf_log_match.go @@ -0,0 +1,114 @@ +package ddosx + +import ( + "errors" + "fmt" + + "github.com/spf13/cobra" + "github.com/ukfast/cli/internal/pkg/factory" + "github.com/ukfast/cli/internal/pkg/helper" + "github.com/ukfast/cli/internal/pkg/output" + "github.com/ukfast/sdk-go/pkg/service/ddosx" +) + +func ddosxWAFLogMatchRootCmd(f factory.ClientFactory) *cobra.Command { + cmd := &cobra.Command{ + Use: "match", + Short: "sub-commands relating to domain web application firewall log matches", + } + + // Child commands + cmd.AddCommand(ddosxWAFLogMatchListCmd(f)) + cmd.AddCommand(ddosxWAFLogMatchShowCmd(f)) + + return cmd +} + +func ddosxWAFLogMatchListCmd(f factory.ClientFactory) *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "Lists WAF log matches", + Long: "This command lists WAF log matches", + Example: "ukfast ddosx waf log match list", + RunE: func(cmd *cobra.Command, args []string) error { + c, err := f.NewClient() + if err != nil { + return err + } + + return ddosxWAFLogMatchList(c.DDoSXService(), cmd, args) + }, + } + + cmd.Flags().String("request", "", "Show matches for specific request") + + return cmd +} + +func ddosxWAFLogMatchList(service ddosx.DDoSXService, cmd *cobra.Command, args []string) error { + params, err := helper.GetAPIRequestParametersFromFlags(cmd) + if err != nil { + return err + } + + var matches []ddosx.WAFLogMatch + + if cmd.Flags().Changed("request") { + request, _ := cmd.Flags().GetString("request") + matches, err = service.GetWAFLogRequestMatches(request, params) + if err != nil { + return fmt.Errorf("Error retrieving WAF log request matches: %s", err) + } + } else { + matches, err = service.GetWAFLogMatches(params) + if err != nil { + return fmt.Errorf("Error retrieving WAF log matches: %s", err) + } + } + + return output.CommandOutput(cmd, OutputDDoSXWAFLogMatchesProvider(matches)) +} + +func ddosxWAFLogMatchShowCmd(f factory.ClientFactory) *cobra.Command { + return &cobra.Command{ + Use: "show ...", + Short: "Shows WAF log request matches", + Long: "This command shows a WAF log request matches", + Example: "ukfast ddosx waf log match show 2d8556677081cecf112b555c359a78c6 123456", + Args: func(cmd *cobra.Command, args []string) error { + if len(args) < 1 { + return errors.New("Missing request") + } + + if len(args) < 2 { + return errors.New("Missing match") + } + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + c, err := f.NewClient() + if err != nil { + return err + } + + return ddosxWAFLogMatchShow(c.DDoSXService(), cmd, args) + }, + } +} + +func ddosxWAFLogMatchShow(service ddosx.DDoSXService, cmd *cobra.Command, args []string) error { + var logs []ddosx.WAFLogMatch + + for _, arg := range args[1:] { + log, err := service.GetWAFLogRequestMatch(args[0], arg) + if err != nil { + output.OutputWithErrorLevelf("Error retrieving WAF log matches [%s]: %s", arg, err.Error()) + continue + } + + logs = append(logs, log) + } + + return output.CommandOutput(cmd, OutputDDoSXWAFLogMatchesProvider(logs)) +} diff --git a/cmd/ddosx/ddosx_waf_log_match_test.go b/cmd/ddosx/ddosx_waf_log_match_test.go new file mode 100644 index 0000000..34f132d --- /dev/null +++ b/cmd/ddosx/ddosx_waf_log_match_test.go @@ -0,0 +1,117 @@ +package ddosx + +import ( + "errors" + "testing" + + gomock "github.com/golang/mock/gomock" + "github.com/spf13/cobra" + "github.com/stretchr/testify/assert" + "github.com/ukfast/cli/test/mocks" + "github.com/ukfast/cli/test/test_output" + "github.com/ukfast/sdk-go/pkg/service/ddosx" +) + +func Test_ddosxWAFLogMatchList(t *testing.T) { + t.Run("WithoutRequest_ExpectedCalls", func(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + + service := mocks.NewMockDDoSXService(mockCtrl) + + service.EXPECT().GetWAFLogMatches(gomock.Any()).Return([]ddosx.WAFLogMatch{}, nil).Times(1) + + ddosxWAFLogMatchList(service, ddosxWAFLogMatchListCmd(nil), []string{}) + }) + + t.Run("WithRequest_ExpectedCalls", func(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + + cmd := ddosxWAFLogMatchListCmd(nil) + cmd.Flags().Set("request", "abcdef") + + service := mocks.NewMockDDoSXService(mockCtrl) + + service.EXPECT().GetWAFLogRequestMatches("abcdef", gomock.Any()).Return([]ddosx.WAFLogMatch{}, nil).Times(1) + + ddosxWAFLogMatchList(service, cmd, []string{}) + }) + + t.Run("GetWAFLogRequestMatches_ReturnsError", func(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + + cmd := ddosxWAFLogMatchListCmd(nil) + cmd.Flags().Set("request", "abcdef") + + service := mocks.NewMockDDoSXService(mockCtrl) + + service.EXPECT().GetWAFLogRequestMatches("abcdef", gomock.Any()).Return([]ddosx.WAFLogMatch{}, errors.New("test error")) + + err := ddosxWAFLogMatchList(service, cmd, []string{}) + + assert.Equal(t, "Error retrieving WAF log request matches: test error", err.Error()) + }) + + t.Run("GetWAFLogMatches_ReturnsError", func(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + + service := mocks.NewMockDDoSXService(mockCtrl) + + service.EXPECT().GetWAFLogMatches(gomock.Any()).Return([]ddosx.WAFLogMatch{}, errors.New("test error")) + + err := ddosxWAFLogMatchList(service, ddosxWAFLogMatchListCmd(nil), []string{}) + + assert.Equal(t, "Error retrieving WAF log matches: test error", err.Error()) + }) +} + +func Test_ddosxWAFLogMatchShowCmd_Args(t *testing.T) { + t.Run("ValidArgs_NoError", func(t *testing.T) { + err := ddosxWAFLogMatchShowCmd(nil).Args(nil, []string{"2d8556677081cecf112b555c359a78c6", "abcdef"}) + + assert.Nil(t, err) + }) + + t.Run("MissingRequest_Error", func(t *testing.T) { + err := ddosxWAFLogMatchShowCmd(nil).Args(nil, []string{}) + + assert.NotNil(t, err) + assert.Equal(t, "Missing request", err.Error()) + }) + + t.Run("MissingMatch_Error", func(t *testing.T) { + err := ddosxWAFLogMatchShowCmd(nil).Args(nil, []string{"2d8556677081cecf112b555c359a78c6"}) + + assert.NotNil(t, err) + assert.Equal(t, "Missing match", err.Error()) + }) +} + +func Test_ddosxWAFLogMatchShow(t *testing.T) { + t.Run("SingleLog", func(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + + service := mocks.NewMockDDoSXService(mockCtrl) + + service.EXPECT().GetWAFLogRequestMatch("2d8556677081cecf112b555c359a78c6", "abcdef").Return(ddosx.WAFLogMatch{}, nil).Times(1) + + ddosxWAFLogMatchShow(service, &cobra.Command{}, []string{"2d8556677081cecf112b555c359a78c6", "abcdef"}) + }) + + t.Run("GetWAFLogMatchError_OutputsError", func(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + + service := mocks.NewMockDDoSXService(mockCtrl) + + service.EXPECT().GetWAFLogRequestMatch("2d8556677081cecf112b555c359a78c6", "abcdef").Return(ddosx.WAFLogMatch{}, errors.New("test error")) + + test_output.AssertErrorOutput(t, "Error retrieving WAF log matches [abcdef]: test error\n", func() { + ddosxWAFLogMatchShow(service, &cobra.Command{}, []string{"2d8556677081cecf112b555c359a78c6", "abcdef"}) + }) + }) +} diff --git a/cmd/ddosx/ddosx_waf_log_test.go b/cmd/ddosx/ddosx_waf_log_test.go new file mode 100644 index 0000000..7aff5fd --- /dev/null +++ b/cmd/ddosx/ddosx_waf_log_test.go @@ -0,0 +1,102 @@ +package ddosx + +import ( + "errors" + "testing" + + gomock "github.com/golang/mock/gomock" + "github.com/spf13/cobra" + "github.com/stretchr/testify/assert" + "github.com/ukfast/cli/test/mocks" + "github.com/ukfast/cli/test/test_output" + "github.com/ukfast/sdk-go/pkg/connection" + "github.com/ukfast/sdk-go/pkg/service/ddosx" +) + +func Test_ddosxWAFLogList(t *testing.T) { + t.Run("NoError", func(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + + service := mocks.NewMockDDoSXService(mockCtrl) + + service.EXPECT().GetWAFLogs(gomock.Any()).Return([]ddosx.WAFLog{}, nil).Times(1) + + ddosxWAFLogList(service, &cobra.Command{}, []string{}) + }) + + t.Run("WithDomainFilter_ExpectedFiltering", func(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + + filtering := connection.NewAPIRequestParameters(). + WithFilter(connection.APIRequestFiltering{ + Property: "domain", + Operator: connection.EQOperator, + Value: []string{"example.com"}, + }) + + cmd := ddosxWAFLogListCmd(nil) + cmd.Flags().Set("domain", "example.com") + + service := mocks.NewMockDDoSXService(mockCtrl) + + service.EXPECT().GetWAFLogs(gomock.Eq(*filtering)).Return([]ddosx.WAFLog{}, nil).Times(1) + + ddosxWAFLogList(service, cmd, []string{}) + }) + + t.Run("GetWAFLogsError_OutputsError", func(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + + service := mocks.NewMockDDoSXService(mockCtrl) + + service.EXPECT().GetWAFLogs(gomock.Any()).Return([]ddosx.WAFLog{}, errors.New("test error")) + + err := ddosxWAFLogList(service, &cobra.Command{}, []string{}) + + assert.Equal(t, "Error retrieving WAF logs: test error", err.Error()) + }) +} + +func Test_ddosxWAFLogShowCmd_Args(t *testing.T) { + t.Run("ValidArgs_NoError", func(t *testing.T) { + err := ddosxWAFLogShowCmd(nil).Args(nil, []string{"2d8556677081cecf112b555c359a78c6"}) + + assert.Nil(t, err) + }) + + t.Run("InvalidArgs_Error", func(t *testing.T) { + err := ddosxWAFLogShowCmd(nil).Args(nil, []string{}) + + assert.NotNil(t, err) + assert.Equal(t, "Missing request", err.Error()) + }) +} + +func Test_ddosxWAFLogShow(t *testing.T) { + t.Run("SingleLog", func(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + + service := mocks.NewMockDDoSXService(mockCtrl) + + service.EXPECT().GetWAFLog("2d8556677081cecf112b555c359a78c6").Return(ddosx.WAFLog{}, nil).Times(1) + + ddosxWAFLogShow(service, &cobra.Command{}, []string{"2d8556677081cecf112b555c359a78c6"}) + }) + + t.Run("GetWAFLogError_OutputsError", func(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + + service := mocks.NewMockDDoSXService(mockCtrl) + + service.EXPECT().GetWAFLog("2d8556677081cecf112b555c359a78c6").Return(ddosx.WAFLog{}, errors.New("test error")) + + test_output.AssertErrorOutput(t, "Error retrieving WAF log [2d8556677081cecf112b555c359a78c6]: test error\n", func() { + ddosxWAFLogShow(service, &cobra.Command{}, []string{"2d8556677081cecf112b555c359a78c6"}) + }) + }) +} diff --git a/cmd/ddosx/output.go b/cmd/ddosx/output.go index 5d0cd52..3a3d66b 100644 --- a/cmd/ddosx/output.go +++ b/cmd/ddosx/output.go @@ -368,3 +368,11 @@ func OutputDDoSXHSTSRulesProvider(rules []ddosx.HSTSRule) output.OutputHandlerPr }), ) } + +func OutputDDoSXWAFLogsProvider(logs []ddosx.WAFLog) output.OutputHandlerProvider { + return output.NewSerializedOutputHandlerProvider(logs).WithDefaultFields([]string{"request_id", "created_at", "client_ip", "request"}) +} + +func OutputDDoSXWAFLogMatchesProvider(matches []ddosx.WAFLogMatch) output.OutputHandlerProvider { + return output.NewSerializedOutputHandlerProvider(matches).WithDefaultFields([]string{"match_id", "created_at", "country_code", "method", "message"}) +} diff --git a/go.mod b/go.mod index f678918..c643be5 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/spf13/cobra v0.0.5 github.com/spf13/viper v1.3.2 github.com/stretchr/testify v1.3.0 - github.com/ukfast/sdk-go v1.3.15 + github.com/ukfast/sdk-go v1.3.16 golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b // indirect gopkg.in/go-playground/assert.v1 v1.2.1 k8s.io/client-go v11.0.0+incompatible diff --git a/go.sum b/go.sum index 409a354..c10c3b9 100644 --- a/go.sum +++ b/go.sum @@ -93,10 +93,10 @@ github.com/tcnksm/go-gitconfig v0.1.2/go.mod h1:/8EhP4H7oJZdIPyT+/UIsG87kTzrzM4U github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ukfast/go-durationstring v1.0.0 h1:kgPuA7XjLjgLDfkG8j0MpolxcZh/eMdiVoOIFD/uc5I= github.com/ukfast/go-durationstring v1.0.0/go.mod h1:Ci81n51kfxlKUIaLY9cINIKRO94VTqV+iCGbOMTb0V8= -github.com/ukfast/sdk-go v1.3.14 h1:eVI6vyyjRHYUoOIdbgyW6xPJx9KSfnLEepdGUAk5OP8= -github.com/ukfast/sdk-go v1.3.14/go.mod h1:VHQi+BbNxVKPu131MHaMFe0UrMoFWbe4LjUqSCt64yg= github.com/ukfast/sdk-go v1.3.15 h1:zwEaGKvHPYVxxQVRxZh9+K3iauCz4DP7SVd6NCXiKhM= github.com/ukfast/sdk-go v1.3.15/go.mod h1:VHQi+BbNxVKPu131MHaMFe0UrMoFWbe4LjUqSCt64yg= +github.com/ukfast/sdk-go v1.3.16 h1:shGVMlaL67AkCLNRY86wVyB1Gt2JSCyzJ0TH1pEtDCg= +github.com/ukfast/sdk-go v1.3.16/go.mod h1:VHQi+BbNxVKPu131MHaMFe0UrMoFWbe4LjUqSCt64yg= github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok= github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= diff --git a/test/mocks/mock_ddosxservice.go b/test/mocks/mock_ddosxservice.go index 648234f..6d2b187 100644 --- a/test/mocks/mock_ddosxservice.go +++ b/test/mocks/mock_ddosxservice.go @@ -1025,6 +1025,126 @@ func (mr *MockDDoSXServiceMockRecorder) GetSSLsPaginated(arg0 interface{}) *gomo return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSSLsPaginated", reflect.TypeOf((*MockDDoSXService)(nil).GetSSLsPaginated), arg0) } +// GetWAFLog mocks base method +func (m *MockDDoSXService) GetWAFLog(arg0 string) (ddosx.WAFLog, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWAFLog", arg0) + ret0, _ := ret[0].(ddosx.WAFLog) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWAFLog indicates an expected call of GetWAFLog +func (mr *MockDDoSXServiceMockRecorder) GetWAFLog(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWAFLog", reflect.TypeOf((*MockDDoSXService)(nil).GetWAFLog), arg0) +} + +// GetWAFLogMatches mocks base method +func (m *MockDDoSXService) GetWAFLogMatches(arg0 connection.APIRequestParameters) ([]ddosx.WAFLogMatch, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWAFLogMatches", arg0) + ret0, _ := ret[0].([]ddosx.WAFLogMatch) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWAFLogMatches indicates an expected call of GetWAFLogMatches +func (mr *MockDDoSXServiceMockRecorder) GetWAFLogMatches(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWAFLogMatches", reflect.TypeOf((*MockDDoSXService)(nil).GetWAFLogMatches), arg0) +} + +// GetWAFLogMatchesPaginated mocks base method +func (m *MockDDoSXService) GetWAFLogMatchesPaginated(arg0 connection.APIRequestParameters) (*ddosx.PaginatedWAFLogMatch, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWAFLogMatchesPaginated", arg0) + ret0, _ := ret[0].(*ddosx.PaginatedWAFLogMatch) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWAFLogMatchesPaginated indicates an expected call of GetWAFLogMatchesPaginated +func (mr *MockDDoSXServiceMockRecorder) GetWAFLogMatchesPaginated(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWAFLogMatchesPaginated", reflect.TypeOf((*MockDDoSXService)(nil).GetWAFLogMatchesPaginated), arg0) +} + +// GetWAFLogRequestMatch mocks base method +func (m *MockDDoSXService) GetWAFLogRequestMatch(arg0, arg1 string) (ddosx.WAFLogMatch, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWAFLogRequestMatch", arg0, arg1) + ret0, _ := ret[0].(ddosx.WAFLogMatch) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWAFLogRequestMatch indicates an expected call of GetWAFLogRequestMatch +func (mr *MockDDoSXServiceMockRecorder) GetWAFLogRequestMatch(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWAFLogRequestMatch", reflect.TypeOf((*MockDDoSXService)(nil).GetWAFLogRequestMatch), arg0, arg1) +} + +// GetWAFLogRequestMatches mocks base method +func (m *MockDDoSXService) GetWAFLogRequestMatches(arg0 string, arg1 connection.APIRequestParameters) ([]ddosx.WAFLogMatch, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWAFLogRequestMatches", arg0, arg1) + ret0, _ := ret[0].([]ddosx.WAFLogMatch) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWAFLogRequestMatches indicates an expected call of GetWAFLogRequestMatches +func (mr *MockDDoSXServiceMockRecorder) GetWAFLogRequestMatches(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWAFLogRequestMatches", reflect.TypeOf((*MockDDoSXService)(nil).GetWAFLogRequestMatches), arg0, arg1) +} + +// GetWAFLogRequestMatchesPaginated mocks base method +func (m *MockDDoSXService) GetWAFLogRequestMatchesPaginated(arg0 string, arg1 connection.APIRequestParameters) (*ddosx.PaginatedWAFLogMatch, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWAFLogRequestMatchesPaginated", arg0, arg1) + ret0, _ := ret[0].(*ddosx.PaginatedWAFLogMatch) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWAFLogRequestMatchesPaginated indicates an expected call of GetWAFLogRequestMatchesPaginated +func (mr *MockDDoSXServiceMockRecorder) GetWAFLogRequestMatchesPaginated(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWAFLogRequestMatchesPaginated", reflect.TypeOf((*MockDDoSXService)(nil).GetWAFLogRequestMatchesPaginated), arg0, arg1) +} + +// GetWAFLogs mocks base method +func (m *MockDDoSXService) GetWAFLogs(arg0 connection.APIRequestParameters) ([]ddosx.WAFLog, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWAFLogs", arg0) + ret0, _ := ret[0].([]ddosx.WAFLog) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWAFLogs indicates an expected call of GetWAFLogs +func (mr *MockDDoSXServiceMockRecorder) GetWAFLogs(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWAFLogs", reflect.TypeOf((*MockDDoSXService)(nil).GetWAFLogs), arg0) +} + +// GetWAFLogsPaginated mocks base method +func (m *MockDDoSXService) GetWAFLogsPaginated(arg0 connection.APIRequestParameters) (*ddosx.PaginatedWAFLog, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetWAFLogsPaginated", arg0) + ret0, _ := ret[0].(*ddosx.PaginatedWAFLog) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWAFLogsPaginated indicates an expected call of GetWAFLogsPaginated +func (mr *MockDDoSXServiceMockRecorder) GetWAFLogsPaginated(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWAFLogsPaginated", reflect.TypeOf((*MockDDoSXService)(nil).GetWAFLogsPaginated), arg0) +} + // PatchDomainACLGeoIPRule mocks base method func (m *MockDDoSXService) PatchDomainACLGeoIPRule(arg0, arg1 string, arg2 ddosx.PatchACLGeoIPRuleRequest) error { m.ctrl.T.Helper()