github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/models/scan_overview.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package 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/validate"
    14  )
    15  
    16  // ScanOverview The scan overview attached in the metadata of tag
    17  //
    18  // swagger:model ScanOverview
    19  type ScanOverview map[string]NativeReportSummary
    20  
    21  // Validate validates this scan overview
    22  func (m ScanOverview) Validate(formats strfmt.Registry) error {
    23  	var res []error
    24  
    25  	for k := range m {
    26  
    27  		if err := validate.Required(k, "body", m[k]); err != nil {
    28  			return err
    29  		}
    30  		if val, ok := m[k]; ok {
    31  			if err := val.Validate(formats); err != nil {
    32  				if ve, ok := err.(*errors.Validation); ok {
    33  					return ve.ValidateName(k)
    34  				} else if ce, ok := err.(*errors.CompositeError); ok {
    35  					return ce.ValidateName(k)
    36  				}
    37  				return err
    38  			}
    39  		}
    40  
    41  	}
    42  
    43  	if len(res) > 0 {
    44  		return errors.CompositeValidationError(res...)
    45  	}
    46  	return nil
    47  }
    48  
    49  // ContextValidate validate this scan overview based on the context it is used
    50  func (m ScanOverview) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    51  	var res []error
    52  
    53  	for k := range m {
    54  
    55  		if val, ok := m[k]; ok {
    56  			if err := val.ContextValidate(ctx, formats); err != nil {
    57  				return err
    58  			}
    59  		}
    60  
    61  	}
    62  
    63  	if len(res) > 0 {
    64  		return errors.CompositeValidationError(res...)
    65  	}
    66  	return nil
    67  }