github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_models/vulnerability.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package mono_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  	"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  // Vulnerability vulnerability
    18  //
    19  // swagger:model Vulnerability
    20  type Vulnerability struct {
    21  
    22  	// access complexity
    23  	AccessComplexity string `json:"accessComplexity,omitempty"`
    24  
    25  	// access vector
    26  	AccessVector string `json:"accessVector,omitempty"`
    27  
    28  	// authentication
    29  	Authentication string `json:"authentication,omitempty"`
    30  
    31  	// availibility impact
    32  	AvailibilityImpact string `json:"availibilityImpact,omitempty"`
    33  
    34  	// base score
    35  	BaseScore float32 `json:"baseScore,omitempty"`
    36  
    37  	// confidentiality impact
    38  	ConfidentialityImpact string `json:"confidentialityImpact,omitempty"`
    39  
    40  	// cweld
    41  	Cweld string `json:"cweld,omitempty"`
    42  
    43  	// description
    44  	Description string `json:"description,omitempty"`
    45  
    46  	// exploitability subscore
    47  	ExploitabilitySubscore float32 `json:"exploitabilitySubscore,omitempty"`
    48  
    49  	// impact subscore
    50  	ImpactSubscore float32 `json:"impactSubscore,omitempty"`
    51  
    52  	// integrity impact
    53  	IntegrityImpact string `json:"integrityImpact,omitempty"`
    54  
    55  	// name
    56  	Name string `json:"name,omitempty"`
    57  
    58  	// published date
    59  	// Format: date-time
    60  	PublishedDate strfmt.DateTime `json:"publishedDate,omitempty"`
    61  
    62  	// severity
    63  	Severity string `json:"severity,omitempty"`
    64  
    65  	// source
    66  	Source string `json:"source,omitempty"`
    67  
    68  	// updated date
    69  	// Format: date-time
    70  	UpdatedDate strfmt.DateTime `json:"updatedDate,omitempty"`
    71  }
    72  
    73  // Validate validates this vulnerability
    74  func (m *Vulnerability) Validate(formats strfmt.Registry) error {
    75  	var res []error
    76  
    77  	if err := m.validatePublishedDate(formats); err != nil {
    78  		res = append(res, err)
    79  	}
    80  
    81  	if err := m.validateUpdatedDate(formats); err != nil {
    82  		res = append(res, err)
    83  	}
    84  
    85  	if len(res) > 0 {
    86  		return errors.CompositeValidationError(res...)
    87  	}
    88  	return nil
    89  }
    90  
    91  func (m *Vulnerability) validatePublishedDate(formats strfmt.Registry) error {
    92  	if swag.IsZero(m.PublishedDate) { // not required
    93  		return nil
    94  	}
    95  
    96  	if err := validate.FormatOf("publishedDate", "body", "date-time", m.PublishedDate.String(), formats); err != nil {
    97  		return err
    98  	}
    99  
   100  	return nil
   101  }
   102  
   103  func (m *Vulnerability) validateUpdatedDate(formats strfmt.Registry) error {
   104  	if swag.IsZero(m.UpdatedDate) { // not required
   105  		return nil
   106  	}
   107  
   108  	if err := validate.FormatOf("updatedDate", "body", "date-time", m.UpdatedDate.String(), formats); err != nil {
   109  		return err
   110  	}
   111  
   112  	return nil
   113  }
   114  
   115  // ContextValidate validates this vulnerability based on context it is used
   116  func (m *Vulnerability) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   117  	return nil
   118  }
   119  
   120  // MarshalBinary interface implementation
   121  func (m *Vulnerability) MarshalBinary() ([]byte, error) {
   122  	if m == nil {
   123  		return nil, nil
   124  	}
   125  	return swag.WriteJSON(m)
   126  }
   127  
   128  // UnmarshalBinary interface implementation
   129  func (m *Vulnerability) UnmarshalBinary(b []byte) error {
   130  	var res Vulnerability
   131  	if err := swag.ReadJSON(b, &res); err != nil {
   132  		return err
   133  	}
   134  	*m = res
   135  	return nil
   136  }