github.com/crowdsecurity/crowdsec@v1.6.1/pkg/modelscapi/success_response.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package modelscapi
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"context"
    10  
    11  	"github.com/go-openapi/errors"
    12  	"github.com/go-openapi/strfmt"
    13  	"github.com/go-openapi/swag"
    14  	"github.com/go-openapi/validate"
    15  )
    16  
    17  // SuccessResponse success response
    18  //
    19  // success response return by the API
    20  //
    21  // swagger:model SuccessResponse
    22  type SuccessResponse struct {
    23  
    24  	// message
    25  	// Required: true
    26  	Message *string `json:"message"`
    27  }
    28  
    29  // Validate validates this success response
    30  func (m *SuccessResponse) Validate(formats strfmt.Registry) error {
    31  	var res []error
    32  
    33  	if err := m.validateMessage(formats); err != nil {
    34  		res = append(res, err)
    35  	}
    36  
    37  	if len(res) > 0 {
    38  		return errors.CompositeValidationError(res...)
    39  	}
    40  	return nil
    41  }
    42  
    43  func (m *SuccessResponse) validateMessage(formats strfmt.Registry) error {
    44  
    45  	if err := validate.Required("message", "body", m.Message); err != nil {
    46  		return err
    47  	}
    48  
    49  	return nil
    50  }
    51  
    52  // ContextValidate validates this success response based on context it is used
    53  func (m *SuccessResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    54  	return nil
    55  }
    56  
    57  // MarshalBinary interface implementation
    58  func (m *SuccessResponse) MarshalBinary() ([]byte, error) {
    59  	if m == nil {
    60  		return nil, nil
    61  	}
    62  	return swag.WriteJSON(m)
    63  }
    64  
    65  // UnmarshalBinary interface implementation
    66  func (m *SuccessResponse) UnmarshalBinary(b []byte) error {
    67  	var res SuccessResponse
    68  	if err := swag.ReadJSON(b, &res); err != nil {
    69  		return err
    70  	}
    71  	*m = res
    72  	return nil
    73  }