diff --git a/Makefile b/Makefile index c08b69c9..4bdcb730 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ specs/swagger-download-patch.json: specs/swagger-stripped-oauth.json specs/swagger-pdf-download-patch.json: specs/swagger-download-patch.json # We add missing binary response body spec to the swagger - jq '.paths."/intel/entities/report-files/v1"."get"."responses"."200"."schema"={"$$ref": "#/definitions/domain.DownloadItem"}' $< > $@ + jq '.paths."/intel/entities/report-files/v1"."get"."responses"."200"."schema"={"$$ref": "#/definitions/domain.DownloadItem"} | .paths."/intel/entities/rules-latest-files/v1"."get"."responses"."200"."schema"={"$$ref": "#/definitions/domain.DownloadItem"}' $< > $@ specs/swagger.json: @echo "Sorry swagger.json needs to be obtained manually at this moment" diff --git a/falcon/client/intel/get_latest_intel_rule_file_responses.go b/falcon/client/intel/get_latest_intel_rule_file_responses.go index 4a1d708f..457aa615 100644 --- a/falcon/client/intel/get_latest_intel_rule_file_responses.go +++ b/falcon/client/intel/get_latest_intel_rule_file_responses.go @@ -20,13 +20,14 @@ import ( // GetLatestIntelRuleFileReader is a Reader for the GetLatestIntelRuleFile structure. type GetLatestIntelRuleFileReader struct { formats strfmt.Registry + writer io.Writer } // ReadResponse reads a server response into the received o. func (o *GetLatestIntelRuleFileReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { case 200: - result := NewGetLatestIntelRuleFileOK() + result := NewGetLatestIntelRuleFileOK(o.writer) if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } @@ -74,8 +75,11 @@ func (o *GetLatestIntelRuleFileReader) ReadResponse(response runtime.ClientRespo } // NewGetLatestIntelRuleFileOK creates a GetLatestIntelRuleFileOK with default headers values -func NewGetLatestIntelRuleFileOK() *GetLatestIntelRuleFileOK { - return &GetLatestIntelRuleFileOK{} +func NewGetLatestIntelRuleFileOK(writer io.Writer) *GetLatestIntelRuleFileOK { + return &GetLatestIntelRuleFileOK{ + + Payload: writer, + } } /* GetLatestIntelRuleFileOK describes a response with status code 200, with default header values. @@ -91,10 +95,15 @@ type GetLatestIntelRuleFileOK struct { /* The number of requests remaining for the sliding one minute window. */ XRateLimitRemaining int64 + + Payload io.Writer } func (o *GetLatestIntelRuleFileOK) Error() string { - return fmt.Sprintf("[GET /intel/entities/rules-latest-files/v1][%d] getLatestIntelRuleFileOK ", 200) + return fmt.Sprintf("[GET /intel/entities/rules-latest-files/v1][%d] getLatestIntelRuleFileOK %+v", 200, o.Payload) +} +func (o *GetLatestIntelRuleFileOK) GetPayload() io.Writer { + return o.Payload } func (o *GetLatestIntelRuleFileOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -121,6 +130,11 @@ func (o *GetLatestIntelRuleFileOK) readResponse(response runtime.ClientResponse, o.XRateLimitRemaining = valxRateLimitRemaining } + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + return nil } diff --git a/falcon/client/intel/intel_client.go b/falcon/client/intel/intel_client.go index eaadd375..751a45a0 100644 --- a/falcon/client/intel/intel_client.go +++ b/falcon/client/intel/intel_client.go @@ -42,7 +42,7 @@ type ClientService interface { GetIntelRuleFile(params *GetIntelRuleFileParams, opts ...ClientOption) (*GetIntelRuleFileOK, error) - GetLatestIntelRuleFile(params *GetLatestIntelRuleFileParams, opts ...ClientOption) (*GetLatestIntelRuleFileOK, error) + GetLatestIntelRuleFile(params *GetLatestIntelRuleFileParams, writer io.Writer, opts ...ClientOption) (*GetLatestIntelRuleFileOK, error) QueryIntelActorEntities(params *QueryIntelActorEntitiesParams, opts ...ClientOption) (*QueryIntelActorEntitiesOK, error) @@ -286,7 +286,7 @@ func (a *Client) GetIntelRuleFile(params *GetIntelRuleFileParams, opts ...Client /* GetLatestIntelRuleFile downloads the latest rule set */ -func (a *Client) GetLatestIntelRuleFile(params *GetLatestIntelRuleFileParams, opts ...ClientOption) (*GetLatestIntelRuleFileOK, error) { +func (a *Client) GetLatestIntelRuleFile(params *GetLatestIntelRuleFileParams, writer io.Writer, opts ...ClientOption) (*GetLatestIntelRuleFileOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetLatestIntelRuleFileParams() @@ -299,7 +299,7 @@ func (a *Client) GetLatestIntelRuleFile(params *GetLatestIntelRuleFileParams, op ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"https"}, Params: params, - Reader: &GetLatestIntelRuleFileReader{formats: a.formats}, + Reader: &GetLatestIntelRuleFileReader{formats: a.formats, writer: writer}, Context: params.Context, Client: params.HTTPClient, }