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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package scan_all
     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 scan all client
    19  type API interface {
    20  	/*
    21  	   CreateScanAllSchedule creates a schedule or a manual trigger for the scan all job
    22  
    23  	   This endpoint is for creating a schedule or a manual trigger for the scan all job, which scans all of images in Harbor.*/
    24  	CreateScanAllSchedule(ctx context.Context, params *CreateScanAllScheduleParams) (*CreateScanAllScheduleCreated, error)
    25  	/*
    26  	   GetLatestScanAllMetrics gets the metrics of the latest scan all process
    27  
    28  	   Get the metrics of the latest scan all process*/
    29  	GetLatestScanAllMetrics(ctx context.Context, params *GetLatestScanAllMetricsParams) (*GetLatestScanAllMetricsOK, error)
    30  	/*
    31  	   GetLatestScheduledScanAllMetrics gets the metrics of the latest scheduled scan all process
    32  
    33  	   Get the metrics of the latest scheduled scan all process*/
    34  	GetLatestScheduledScanAllMetrics(ctx context.Context, params *GetLatestScheduledScanAllMetricsParams) (*GetLatestScheduledScanAllMetricsOK, error)
    35  	/*
    36  	   GetScanAllSchedule gets scan all s schedule
    37  
    38  	   This endpoint is for getting a schedule for the scan all job, which scans all of images in Harbor.*/
    39  	GetScanAllSchedule(ctx context.Context, params *GetScanAllScheduleParams) (*GetScanAllScheduleOK, error)
    40  	/*
    41  	   StopScanAll stops scan all job execution
    42  
    43  	   Stop scanAll job execution*/
    44  	StopScanAll(ctx context.Context, params *StopScanAllParams) (*StopScanAllAccepted, error)
    45  	/*
    46  	   UpdateScanAllSchedule updates scan all s schedule
    47  
    48  	   This endpoint is for updating the schedule of scan all job, which scans all of images in Harbor.*/
    49  	UpdateScanAllSchedule(ctx context.Context, params *UpdateScanAllScheduleParams) (*UpdateScanAllScheduleOK, error)
    50  }
    51  
    52  // New creates a new scan all API client.
    53  func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client {
    54  	return &Client{
    55  		transport: transport,
    56  		formats:   formats,
    57  		authInfo:  authInfo,
    58  	}
    59  }
    60  
    61  /*
    62  Client for scan all API
    63  */
    64  type Client struct {
    65  	transport runtime.ClientTransport
    66  	formats   strfmt.Registry
    67  	authInfo  runtime.ClientAuthInfoWriter
    68  }
    69  
    70  /*
    71  CreateScanAllSchedule creates a schedule or a manual trigger for the scan all job
    72  
    73  This endpoint is for creating a schedule or a manual trigger for the scan all job, which scans all of images in Harbor.
    74  */
    75  func (a *Client) CreateScanAllSchedule(ctx context.Context, params *CreateScanAllScheduleParams) (*CreateScanAllScheduleCreated, error) {
    76  
    77  	result, err := a.transport.Submit(&runtime.ClientOperation{
    78  		ID:                 "createScanAllSchedule",
    79  		Method:             "POST",
    80  		PathPattern:        "/system/scanAll/schedule",
    81  		ProducesMediaTypes: []string{"application/json"},
    82  		ConsumesMediaTypes: []string{"application/json"},
    83  		Schemes:            []string{"http", "https"},
    84  		Params:             params,
    85  		Reader:             &CreateScanAllScheduleReader{formats: a.formats},
    86  		AuthInfo:           a.authInfo,
    87  		Context:            ctx,
    88  		Client:             params.HTTPClient,
    89  	})
    90  	if err != nil {
    91  		return nil, err
    92  	}
    93  	return result.(*CreateScanAllScheduleCreated), nil
    94  
    95  }
    96  
    97  /*
    98  GetLatestScanAllMetrics gets the metrics of the latest scan all process
    99  
   100  Get the metrics of the latest scan all process
   101  */
   102  func (a *Client) GetLatestScanAllMetrics(ctx context.Context, params *GetLatestScanAllMetricsParams) (*GetLatestScanAllMetricsOK, error) {
   103  
   104  	result, err := a.transport.Submit(&runtime.ClientOperation{
   105  		ID:                 "getLatestScanAllMetrics",
   106  		Method:             "GET",
   107  		PathPattern:        "/scans/all/metrics",
   108  		ProducesMediaTypes: []string{"application/json"},
   109  		ConsumesMediaTypes: []string{"application/json"},
   110  		Schemes:            []string{"http", "https"},
   111  		Params:             params,
   112  		Reader:             &GetLatestScanAllMetricsReader{formats: a.formats},
   113  		AuthInfo:           a.authInfo,
   114  		Context:            ctx,
   115  		Client:             params.HTTPClient,
   116  	})
   117  	if err != nil {
   118  		return nil, err
   119  	}
   120  	return result.(*GetLatestScanAllMetricsOK), nil
   121  
   122  }
   123  
   124  /*
   125  GetLatestScheduledScanAllMetrics gets the metrics of the latest scheduled scan all process
   126  
   127  Get the metrics of the latest scheduled scan all process
   128  */
   129  func (a *Client) GetLatestScheduledScanAllMetrics(ctx context.Context, params *GetLatestScheduledScanAllMetricsParams) (*GetLatestScheduledScanAllMetricsOK, error) {
   130  
   131  	result, err := a.transport.Submit(&runtime.ClientOperation{
   132  		ID:                 "getLatestScheduledScanAllMetrics",
   133  		Method:             "GET",
   134  		PathPattern:        "/scans/schedule/metrics",
   135  		ProducesMediaTypes: []string{"application/json"},
   136  		ConsumesMediaTypes: []string{"application/json"},
   137  		Schemes:            []string{"http", "https"},
   138  		Params:             params,
   139  		Reader:             &GetLatestScheduledScanAllMetricsReader{formats: a.formats},
   140  		AuthInfo:           a.authInfo,
   141  		Context:            ctx,
   142  		Client:             params.HTTPClient,
   143  	})
   144  	if err != nil {
   145  		return nil, err
   146  	}
   147  	return result.(*GetLatestScheduledScanAllMetricsOK), nil
   148  
   149  }
   150  
   151  /*
   152  GetScanAllSchedule gets scan all s schedule
   153  
   154  This endpoint is for getting a schedule for the scan all job, which scans all of images in Harbor.
   155  */
   156  func (a *Client) GetScanAllSchedule(ctx context.Context, params *GetScanAllScheduleParams) (*GetScanAllScheduleOK, error) {
   157  
   158  	result, err := a.transport.Submit(&runtime.ClientOperation{
   159  		ID:                 "getScanAllSchedule",
   160  		Method:             "GET",
   161  		PathPattern:        "/system/scanAll/schedule",
   162  		ProducesMediaTypes: []string{"application/json"},
   163  		ConsumesMediaTypes: []string{"application/json"},
   164  		Schemes:            []string{"http", "https"},
   165  		Params:             params,
   166  		Reader:             &GetScanAllScheduleReader{formats: a.formats},
   167  		AuthInfo:           a.authInfo,
   168  		Context:            ctx,
   169  		Client:             params.HTTPClient,
   170  	})
   171  	if err != nil {
   172  		return nil, err
   173  	}
   174  	return result.(*GetScanAllScheduleOK), nil
   175  
   176  }
   177  
   178  /*
   179  StopScanAll stops scan all job execution
   180  
   181  Stop scanAll job execution
   182  */
   183  func (a *Client) StopScanAll(ctx context.Context, params *StopScanAllParams) (*StopScanAllAccepted, error) {
   184  
   185  	result, err := a.transport.Submit(&runtime.ClientOperation{
   186  		ID:                 "stopScanAll",
   187  		Method:             "POST",
   188  		PathPattern:        "/system/scanAll/stop",
   189  		ProducesMediaTypes: []string{"application/json"},
   190  		ConsumesMediaTypes: []string{"application/json"},
   191  		Schemes:            []string{"http", "https"},
   192  		Params:             params,
   193  		Reader:             &StopScanAllReader{formats: a.formats},
   194  		AuthInfo:           a.authInfo,
   195  		Context:            ctx,
   196  		Client:             params.HTTPClient,
   197  	})
   198  	if err != nil {
   199  		return nil, err
   200  	}
   201  	return result.(*StopScanAllAccepted), nil
   202  
   203  }
   204  
   205  /*
   206  UpdateScanAllSchedule updates scan all s schedule
   207  
   208  This endpoint is for updating the schedule of scan all job, which scans all of images in Harbor.
   209  */
   210  func (a *Client) UpdateScanAllSchedule(ctx context.Context, params *UpdateScanAllScheduleParams) (*UpdateScanAllScheduleOK, error) {
   211  
   212  	result, err := a.transport.Submit(&runtime.ClientOperation{
   213  		ID:                 "updateScanAllSchedule",
   214  		Method:             "PUT",
   215  		PathPattern:        "/system/scanAll/schedule",
   216  		ProducesMediaTypes: []string{"application/json"},
   217  		ConsumesMediaTypes: []string{"application/json"},
   218  		Schemes:            []string{"http", "https"},
   219  		Params:             params,
   220  		Reader:             &UpdateScanAllScheduleReader{formats: a.formats},
   221  		AuthInfo:           a.authInfo,
   222  		Context:            ctx,
   223  		Client:             params.HTTPClient,
   224  	})
   225  	if err != nil {
   226  		return nil, err
   227  	}
   228  	return result.(*UpdateScanAllScheduleOK), nil
   229  
   230  }