github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/buildlogstream/buildlogstream_models/log_request.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package buildlogstream_models
     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  	"github.com/go-openapi/errors"
    10  	"github.com/go-openapi/strfmt"
    11  	"github.com/go-openapi/swag"
    12  	"github.com/go-openapi/validate"
    13  )
    14  
    15  // LogRequest log request
    16  //
    17  // swagger:model LogRequest
    18  type LogRequest struct {
    19  
    20  	// Request log lines from the build of the specified artifact. Only supported for builds executed by builders.
    21  	// Format: uuid
    22  	ArtifactID strfmt.UUID `json:"artifactID,omitempty"`
    23  
    24  	// Request build events and log lines from the specified build request. Only supported for builds executed by camel.
    25  	// Format: uuid
    26  	BuildRequestID strfmt.UUID `json:"buildRequestID,omitempty"`
    27  
    28  	// Request build events from the specified recipe. Only supported for builds executed by builders.
    29  	// Format: uuid
    30  	RecipeID strfmt.UUID `json:"recipeID,omitempty"`
    31  }
    32  
    33  // Validate validates this log request
    34  func (m *LogRequest) Validate(formats strfmt.Registry) error {
    35  	var res []error
    36  
    37  	if err := m.validateArtifactID(formats); err != nil {
    38  		res = append(res, err)
    39  	}
    40  
    41  	if err := m.validateBuildRequestID(formats); err != nil {
    42  		res = append(res, err)
    43  	}
    44  
    45  	if err := m.validateRecipeID(formats); err != nil {
    46  		res = append(res, err)
    47  	}
    48  
    49  	if len(res) > 0 {
    50  		return errors.CompositeValidationError(res...)
    51  	}
    52  	return nil
    53  }
    54  
    55  func (m *LogRequest) validateArtifactID(formats strfmt.Registry) error {
    56  
    57  	if swag.IsZero(m.ArtifactID) { // not required
    58  		return nil
    59  	}
    60  
    61  	if err := validate.FormatOf("artifactID", "body", "uuid", m.ArtifactID.String(), formats); err != nil {
    62  		return err
    63  	}
    64  
    65  	return nil
    66  }
    67  
    68  func (m *LogRequest) validateBuildRequestID(formats strfmt.Registry) error {
    69  
    70  	if swag.IsZero(m.BuildRequestID) { // not required
    71  		return nil
    72  	}
    73  
    74  	if err := validate.FormatOf("buildRequestID", "body", "uuid", m.BuildRequestID.String(), formats); err != nil {
    75  		return err
    76  	}
    77  
    78  	return nil
    79  }
    80  
    81  func (m *LogRequest) validateRecipeID(formats strfmt.Registry) error {
    82  
    83  	if swag.IsZero(m.RecipeID) { // not required
    84  		return nil
    85  	}
    86  
    87  	if err := validate.FormatOf("recipeID", "body", "uuid", m.RecipeID.String(), formats); err != nil {
    88  		return err
    89  	}
    90  
    91  	return nil
    92  }
    93  
    94  // MarshalBinary interface implementation
    95  func (m *LogRequest) MarshalBinary() ([]byte, error) {
    96  	if m == nil {
    97  		return nil, nil
    98  	}
    99  	return swag.WriteJSON(m)
   100  }
   101  
   102  // UnmarshalBinary interface implementation
   103  func (m *LogRequest) UnmarshalBinary(b []byte) error {
   104  	var res LogRequest
   105  	if err := swag.ReadJSON(b, &res); err != nil {
   106  		return err
   107  	}
   108  	*m = res
   109  	return nil
   110  }