github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/buildlogstream/buildlogstream_models/task_failed.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  // TaskFailed Task Failed
    16  //
    17  // A message indicating that a requested task for a build failed.
    18  //
    19  // swagger:model taskFailed
    20  type TaskFailed struct {
    21  
    22  	// All of the errors from the failed task.
    23  	// Required: true
    24  	Errors []string `json:"errors"`
    25  
    26  	// task
    27  	// Required: true
    28  	Task *string `json:"task"`
    29  }
    30  
    31  // Validate validates this task failed
    32  func (m *TaskFailed) Validate(formats strfmt.Registry) error {
    33  	var res []error
    34  
    35  	if err := m.validateErrors(formats); err != nil {
    36  		res = append(res, err)
    37  	}
    38  
    39  	if err := m.validateTask(formats); err != nil {
    40  		res = append(res, err)
    41  	}
    42  
    43  	if len(res) > 0 {
    44  		return errors.CompositeValidationError(res...)
    45  	}
    46  	return nil
    47  }
    48  
    49  func (m *TaskFailed) validateErrors(formats strfmt.Registry) error {
    50  
    51  	if err := validate.Required("errors", "body", m.Errors); err != nil {
    52  		return err
    53  	}
    54  
    55  	return nil
    56  }
    57  
    58  func (m *TaskFailed) validateTask(formats strfmt.Registry) error {
    59  
    60  	if err := validate.Required("task", "body", m.Task); err != nil {
    61  		return err
    62  	}
    63  
    64  	return nil
    65  }
    66  
    67  // MarshalBinary interface implementation
    68  func (m *TaskFailed) MarshalBinary() ([]byte, error) {
    69  	if m == nil {
    70  		return nil, nil
    71  	}
    72  	return swag.WriteJSON(m)
    73  }
    74  
    75  // UnmarshalBinary interface implementation
    76  func (m *TaskFailed) UnmarshalBinary(b []byte) error {
    77  	var res TaskFailed
    78  	if err := swag.ReadJSON(b, &res); err != nil {
    79  		return err
    80  	}
    81  	*m = res
    82  	return nil
    83  }