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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package scanner
     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 scanner client
    19  type API interface {
    20  	/*
    21  	   CreateScanner creates a scanner registration
    22  
    23  	   Creats a new scanner registration with the given data.
    24  	*/
    25  	CreateScanner(ctx context.Context, params *CreateScannerParams) (*CreateScannerCreated, error)
    26  	/*
    27  	   DeleteScanner deletes a scanner registration
    28  
    29  	   Deletes the specified scanner registration.
    30  	*/
    31  	DeleteScanner(ctx context.Context, params *DeleteScannerParams) (*DeleteScannerOK, error)
    32  	/*
    33  	   GetScanner gets a scanner registration details
    34  
    35  	   Retruns the details of the specified scanner registration.
    36  	*/
    37  	GetScanner(ctx context.Context, params *GetScannerParams) (*GetScannerOK, error)
    38  	/*
    39  	   GetScannerMetadata gets the metadata of the specified scanner registration
    40  
    41  	   Get the metadata of the specified scanner registration, including the capabilities and customized properties.
    42  	*/
    43  	GetScannerMetadata(ctx context.Context, params *GetScannerMetadataParams) (*GetScannerMetadataOK, error)
    44  	/*
    45  	   ListScanners lists scanner registrations
    46  
    47  	   Returns a list of currently configured scanner registrations.
    48  	*/
    49  	ListScanners(ctx context.Context, params *ListScannersParams) (*ListScannersOK, error)
    50  	/*
    51  	   PingScanner tests scanner registration settings
    52  
    53  	   Pings scanner adapter to test endpoint URL and authorization settings.
    54  	*/
    55  	PingScanner(ctx context.Context, params *PingScannerParams) (*PingScannerOK, error)
    56  	/*
    57  	   SetScannerAsDefault sets system default scanner registration
    58  
    59  	   Set the specified scanner registration as the system default one.
    60  	*/
    61  	SetScannerAsDefault(ctx context.Context, params *SetScannerAsDefaultParams) (*SetScannerAsDefaultOK, error)
    62  	/*
    63  	   UpdateScanner updates a scanner registration
    64  
    65  	   Updates the specified scanner registration.
    66  	*/
    67  	UpdateScanner(ctx context.Context, params *UpdateScannerParams) (*UpdateScannerOK, error)
    68  }
    69  
    70  // New creates a new scanner API client.
    71  func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client {
    72  	return &Client{
    73  		transport: transport,
    74  		formats:   formats,
    75  		authInfo:  authInfo,
    76  	}
    77  }
    78  
    79  /*
    80  Client for scanner API
    81  */
    82  type Client struct {
    83  	transport runtime.ClientTransport
    84  	formats   strfmt.Registry
    85  	authInfo  runtime.ClientAuthInfoWriter
    86  }
    87  
    88  /*
    89  CreateScanner creates a scanner registration
    90  
    91  Creats a new scanner registration with the given data.
    92  */
    93  func (a *Client) CreateScanner(ctx context.Context, params *CreateScannerParams) (*CreateScannerCreated, error) {
    94  
    95  	result, err := a.transport.Submit(&runtime.ClientOperation{
    96  		ID:                 "createScanner",
    97  		Method:             "POST",
    98  		PathPattern:        "/scanners",
    99  		ProducesMediaTypes: []string{"application/json"},
   100  		ConsumesMediaTypes: []string{"application/json"},
   101  		Schemes:            []string{"http", "https"},
   102  		Params:             params,
   103  		Reader:             &CreateScannerReader{formats: a.formats},
   104  		AuthInfo:           a.authInfo,
   105  		Context:            ctx,
   106  		Client:             params.HTTPClient,
   107  	})
   108  	if err != nil {
   109  		return nil, err
   110  	}
   111  	return result.(*CreateScannerCreated), nil
   112  
   113  }
   114  
   115  /*
   116  DeleteScanner deletes a scanner registration
   117  
   118  Deletes the specified scanner registration.
   119  */
   120  func (a *Client) DeleteScanner(ctx context.Context, params *DeleteScannerParams) (*DeleteScannerOK, error) {
   121  
   122  	result, err := a.transport.Submit(&runtime.ClientOperation{
   123  		ID:                 "deleteScanner",
   124  		Method:             "DELETE",
   125  		PathPattern:        "/scanners/{registration_id}",
   126  		ProducesMediaTypes: []string{"application/json"},
   127  		ConsumesMediaTypes: []string{"application/json"},
   128  		Schemes:            []string{"http", "https"},
   129  		Params:             params,
   130  		Reader:             &DeleteScannerReader{formats: a.formats},
   131  		AuthInfo:           a.authInfo,
   132  		Context:            ctx,
   133  		Client:             params.HTTPClient,
   134  	})
   135  	if err != nil {
   136  		return nil, err
   137  	}
   138  	return result.(*DeleteScannerOK), nil
   139  
   140  }
   141  
   142  /*
   143  GetScanner gets a scanner registration details
   144  
   145  Retruns the details of the specified scanner registration.
   146  */
   147  func (a *Client) GetScanner(ctx context.Context, params *GetScannerParams) (*GetScannerOK, error) {
   148  
   149  	result, err := a.transport.Submit(&runtime.ClientOperation{
   150  		ID:                 "getScanner",
   151  		Method:             "GET",
   152  		PathPattern:        "/scanners/{registration_id}",
   153  		ProducesMediaTypes: []string{"application/json"},
   154  		ConsumesMediaTypes: []string{"application/json"},
   155  		Schemes:            []string{"http", "https"},
   156  		Params:             params,
   157  		Reader:             &GetScannerReader{formats: a.formats},
   158  		AuthInfo:           a.authInfo,
   159  		Context:            ctx,
   160  		Client:             params.HTTPClient,
   161  	})
   162  	if err != nil {
   163  		return nil, err
   164  	}
   165  	return result.(*GetScannerOK), nil
   166  
   167  }
   168  
   169  /*
   170  GetScannerMetadata gets the metadata of the specified scanner registration
   171  
   172  Get the metadata of the specified scanner registration, including the capabilities and customized properties.
   173  */
   174  func (a *Client) GetScannerMetadata(ctx context.Context, params *GetScannerMetadataParams) (*GetScannerMetadataOK, error) {
   175  
   176  	result, err := a.transport.Submit(&runtime.ClientOperation{
   177  		ID:                 "getScannerMetadata",
   178  		Method:             "GET",
   179  		PathPattern:        "/scanners/{registration_id}/metadata",
   180  		ProducesMediaTypes: []string{"application/json"},
   181  		ConsumesMediaTypes: []string{"application/json"},
   182  		Schemes:            []string{"http", "https"},
   183  		Params:             params,
   184  		Reader:             &GetScannerMetadataReader{formats: a.formats},
   185  		AuthInfo:           a.authInfo,
   186  		Context:            ctx,
   187  		Client:             params.HTTPClient,
   188  	})
   189  	if err != nil {
   190  		return nil, err
   191  	}
   192  	return result.(*GetScannerMetadataOK), nil
   193  
   194  }
   195  
   196  /*
   197  ListScanners lists scanner registrations
   198  
   199  Returns a list of currently configured scanner registrations.
   200  */
   201  func (a *Client) ListScanners(ctx context.Context, params *ListScannersParams) (*ListScannersOK, error) {
   202  
   203  	result, err := a.transport.Submit(&runtime.ClientOperation{
   204  		ID:                 "listScanners",
   205  		Method:             "GET",
   206  		PathPattern:        "/scanners",
   207  		ProducesMediaTypes: []string{"application/json"},
   208  		ConsumesMediaTypes: []string{"application/json"},
   209  		Schemes:            []string{"http", "https"},
   210  		Params:             params,
   211  		Reader:             &ListScannersReader{formats: a.formats},
   212  		AuthInfo:           a.authInfo,
   213  		Context:            ctx,
   214  		Client:             params.HTTPClient,
   215  	})
   216  	if err != nil {
   217  		return nil, err
   218  	}
   219  	return result.(*ListScannersOK), nil
   220  
   221  }
   222  
   223  /*
   224  PingScanner tests scanner registration settings
   225  
   226  Pings scanner adapter to test endpoint URL and authorization settings.
   227  */
   228  func (a *Client) PingScanner(ctx context.Context, params *PingScannerParams) (*PingScannerOK, error) {
   229  
   230  	result, err := a.transport.Submit(&runtime.ClientOperation{
   231  		ID:                 "pingScanner",
   232  		Method:             "POST",
   233  		PathPattern:        "/scanners/ping",
   234  		ProducesMediaTypes: []string{"application/json"},
   235  		ConsumesMediaTypes: []string{"application/json"},
   236  		Schemes:            []string{"http", "https"},
   237  		Params:             params,
   238  		Reader:             &PingScannerReader{formats: a.formats},
   239  		AuthInfo:           a.authInfo,
   240  		Context:            ctx,
   241  		Client:             params.HTTPClient,
   242  	})
   243  	if err != nil {
   244  		return nil, err
   245  	}
   246  	return result.(*PingScannerOK), nil
   247  
   248  }
   249  
   250  /*
   251  SetScannerAsDefault sets system default scanner registration
   252  
   253  Set the specified scanner registration as the system default one.
   254  */
   255  func (a *Client) SetScannerAsDefault(ctx context.Context, params *SetScannerAsDefaultParams) (*SetScannerAsDefaultOK, error) {
   256  
   257  	result, err := a.transport.Submit(&runtime.ClientOperation{
   258  		ID:                 "setScannerAsDefault",
   259  		Method:             "PATCH",
   260  		PathPattern:        "/scanners/{registration_id}",
   261  		ProducesMediaTypes: []string{"application/json"},
   262  		ConsumesMediaTypes: []string{"application/json"},
   263  		Schemes:            []string{"http", "https"},
   264  		Params:             params,
   265  		Reader:             &SetScannerAsDefaultReader{formats: a.formats},
   266  		AuthInfo:           a.authInfo,
   267  		Context:            ctx,
   268  		Client:             params.HTTPClient,
   269  	})
   270  	if err != nil {
   271  		return nil, err
   272  	}
   273  	return result.(*SetScannerAsDefaultOK), nil
   274  
   275  }
   276  
   277  /*
   278  UpdateScanner updates a scanner registration
   279  
   280  Updates the specified scanner registration.
   281  */
   282  func (a *Client) UpdateScanner(ctx context.Context, params *UpdateScannerParams) (*UpdateScannerOK, error) {
   283  
   284  	result, err := a.transport.Submit(&runtime.ClientOperation{
   285  		ID:                 "updateScanner",
   286  		Method:             "PUT",
   287  		PathPattern:        "/scanners/{registration_id}",
   288  		ProducesMediaTypes: []string{"application/json"},
   289  		ConsumesMediaTypes: []string{"application/json"},
   290  		Schemes:            []string{"http", "https"},
   291  		Params:             params,
   292  		Reader:             &UpdateScannerReader{formats: a.formats},
   293  		AuthInfo:           a.authInfo,
   294  		Context:            ctx,
   295  		Client:             params.HTTPClient,
   296  	})
   297  	if err != nil {
   298  		return nil, err
   299  	}
   300  	return result.(*UpdateScannerOK), nil
   301  
   302  }