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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package securityhub
     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/runtime"
    12  
    13  	strfmt "github.com/go-openapi/strfmt"
    14  )
    15  
    16  //go:generate mockery -name API -inpkg
    17  
    18  // API is the interface of the securityhub client
    19  type API interface {
    20  	/*
    21  	   ListVulnerabilities gets the vulnerability list
    22  
    23  	   Get the vulnerability list. use q to pass the query condition,
    24  	   supported conditions:
    25  	   cve_id(exact match)
    26  	   cvss_score_v3(range condition)
    27  	   severity(exact match)
    28  	   repository_name(exact match)
    29  	   project_id(exact match)
    30  	   package(exact match)
    31  	   tag(exact match)
    32  	   digest(exact match)
    33  	*/
    34  	ListVulnerabilities(ctx context.Context, params *ListVulnerabilitiesParams) (*ListVulnerabilitiesOK, error)
    35  	/*
    36  	   GetSecuritySummary gets vulnerability system summary
    37  
    38  	   Retrieve the vulnerability summary of the system*/
    39  	GetSecuritySummary(ctx context.Context, params *GetSecuritySummaryParams) (*GetSecuritySummaryOK, error)
    40  }
    41  
    42  // New creates a new securityhub API client.
    43  func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client {
    44  	return &Client{
    45  		transport: transport,
    46  		formats:   formats,
    47  		authInfo:  authInfo,
    48  	}
    49  }
    50  
    51  /*
    52  Client for securityhub API
    53  */
    54  type Client struct {
    55  	transport runtime.ClientTransport
    56  	formats   strfmt.Registry
    57  	authInfo  runtime.ClientAuthInfoWriter
    58  }
    59  
    60  /*
    61  ListVulnerabilities gets the vulnerability list
    62  
    63  Get the vulnerability list. use q to pass the query condition,
    64  supported conditions:
    65  cve_id(exact match)
    66  cvss_score_v3(range condition)
    67  severity(exact match)
    68  repository_name(exact match)
    69  project_id(exact match)
    70  package(exact match)
    71  tag(exact match)
    72  digest(exact match)
    73  */
    74  func (a *Client) ListVulnerabilities(ctx context.Context, params *ListVulnerabilitiesParams) (*ListVulnerabilitiesOK, error) {
    75  
    76  	result, err := a.transport.Submit(&runtime.ClientOperation{
    77  		ID:                 "ListVulnerabilities",
    78  		Method:             "GET",
    79  		PathPattern:        "/security/vul",
    80  		ProducesMediaTypes: []string{"application/json"},
    81  		ConsumesMediaTypes: []string{"application/json"},
    82  		Schemes:            []string{"http", "https"},
    83  		Params:             params,
    84  		Reader:             &ListVulnerabilitiesReader{formats: a.formats},
    85  		AuthInfo:           a.authInfo,
    86  		Context:            ctx,
    87  		Client:             params.HTTPClient,
    88  	})
    89  	if err != nil {
    90  		return nil, err
    91  	}
    92  	return result.(*ListVulnerabilitiesOK), nil
    93  
    94  }
    95  
    96  /*
    97  GetSecuritySummary gets vulnerability system summary
    98  
    99  Retrieve the vulnerability summary of the system
   100  */
   101  func (a *Client) GetSecuritySummary(ctx context.Context, params *GetSecuritySummaryParams) (*GetSecuritySummaryOK, error) {
   102  
   103  	result, err := a.transport.Submit(&runtime.ClientOperation{
   104  		ID:                 "getSecuritySummary",
   105  		Method:             "GET",
   106  		PathPattern:        "/security/summary",
   107  		ProducesMediaTypes: []string{"application/json"},
   108  		ConsumesMediaTypes: []string{"application/json"},
   109  		Schemes:            []string{"http", "https"},
   110  		Params:             params,
   111  		Reader:             &GetSecuritySummaryReader{formats: a.formats},
   112  		AuthInfo:           a.authInfo,
   113  		Context:            ctx,
   114  		Client:             params.HTTPClient,
   115  	})
   116  	if err != nil {
   117  		return nil, err
   118  	}
   119  	return result.(*GetSecuritySummaryOK), nil
   120  
   121  }