github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/buildlogstream/buildlogstream_models/build_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  // BuildFailed Build Failed
    16  //
    17  // A message indicating that a build failed.
    18  //
    19  // swagger:model BuildFailed
    20  type BuildFailed struct {
    21  
    22  	// All of the errors from the failed build. Note that these errors may not be suitable for presenting to users and should simply be logged for further investigation.
    23  	// Required: true
    24  	Errors []string `json:"errors"`
    25  
    26  	// If true this failed build can be retried and it may succeed. If false, retrying this failed build will not change the outcome. This field's value is only valid when type is build_failed.
    27  	// Required: true
    28  	IsRetryable bool `json:"is_retryable"`
    29  
    30  	// An S3 URI containing the log for this build.
    31  	// Format: uri
    32  	LogURI strfmt.URI `json:"log_uri,omitempty"`
    33  
    34  	// A user-facing message describing the build results.
    35  	Message string `json:"message,omitempty"`
    36  }
    37  
    38  // Validate validates this build failed
    39  func (m *BuildFailed) Validate(formats strfmt.Registry) error {
    40  	var res []error
    41  
    42  	if err := m.validateErrors(formats); err != nil {
    43  		res = append(res, err)
    44  	}
    45  
    46  	if err := m.validateIsRetryable(formats); err != nil {
    47  		res = append(res, err)
    48  	}
    49  
    50  	if err := m.validateLogURI(formats); err != nil {
    51  		res = append(res, err)
    52  	}
    53  
    54  	if len(res) > 0 {
    55  		return errors.CompositeValidationError(res...)
    56  	}
    57  	return nil
    58  }
    59  
    60  func (m *BuildFailed) validateErrors(formats strfmt.Registry) error {
    61  
    62  	if err := validate.Required("errors", "body", m.Errors); err != nil {
    63  		return err
    64  	}
    65  
    66  	return nil
    67  }
    68  
    69  func (m *BuildFailed) validateIsRetryable(formats strfmt.Registry) error {
    70  
    71  	if err := validate.Required("is_retryable", "body", bool(m.IsRetryable)); err != nil {
    72  		return err
    73  	}
    74  
    75  	return nil
    76  }
    77  
    78  func (m *BuildFailed) validateLogURI(formats strfmt.Registry) error {
    79  
    80  	if swag.IsZero(m.LogURI) { // not required
    81  		return nil
    82  	}
    83  
    84  	if err := validate.FormatOf("log_uri", "body", "uri", m.LogURI.String(), formats); err != nil {
    85  		return err
    86  	}
    87  
    88  	return nil
    89  }
    90  
    91  // MarshalBinary interface implementation
    92  func (m *BuildFailed) MarshalBinary() ([]byte, error) {
    93  	if m == nil {
    94  		return nil, nil
    95  	}
    96  	return swag.WriteJSON(m)
    97  }
    98  
    99  // UnmarshalBinary interface implementation
   100  func (m *BuildFailed) UnmarshalBinary(b []byte) error {
   101  	var res BuildFailed
   102  	if err := swag.ReadJSON(b, &res); err != nil {
   103  		return err
   104  	}
   105  	*m = res
   106  	return nil
   107  }