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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package jobservice
     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 jobservice client
    19  type API interface {
    20  	/*
    21  	   ActionGetJobLog gets job log by job id
    22  
    23  	   Get job log by job id, it is only used by administrator*/
    24  	ActionGetJobLog(ctx context.Context, params *ActionGetJobLogParams) (*ActionGetJobLogOK, error)
    25  	/*
    26  	   ActionPendingJobs stops and clean pause resume pending jobs in the queue
    27  
    28  	   stop and clean, pause, resume pending jobs in the queue*/
    29  	ActionPendingJobs(ctx context.Context, params *ActionPendingJobsParams) (*ActionPendingJobsOK, error)
    30  	/*
    31  	   GetWorkerPools gets worker pools
    32  
    33  	   Get worker pools*/
    34  	GetWorkerPools(ctx context.Context, params *GetWorkerPoolsParams) (*GetWorkerPoolsOK, error)
    35  	/*
    36  	   GetWorkers gets workers
    37  
    38  	   Get workers in current pool*/
    39  	GetWorkers(ctx context.Context, params *GetWorkersParams) (*GetWorkersOK, error)
    40  	/*
    41  	   ListJobQueues lists job queues
    42  
    43  	   list job queue*/
    44  	ListJobQueues(ctx context.Context, params *ListJobQueuesParams) (*ListJobQueuesOK, error)
    45  	/*
    46  	   StopRunningJob stops running job
    47  
    48  	   Stop running job*/
    49  	StopRunningJob(ctx context.Context, params *StopRunningJobParams) (*StopRunningJobOK, error)
    50  }
    51  
    52  // New creates a new jobservice 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 jobservice API
    63  */
    64  type Client struct {
    65  	transport runtime.ClientTransport
    66  	formats   strfmt.Registry
    67  	authInfo  runtime.ClientAuthInfoWriter
    68  }
    69  
    70  /*
    71  ActionGetJobLog gets job log by job id
    72  
    73  Get job log by job id, it is only used by administrator
    74  */
    75  func (a *Client) ActionGetJobLog(ctx context.Context, params *ActionGetJobLogParams) (*ActionGetJobLogOK, error) {
    76  
    77  	result, err := a.transport.Submit(&runtime.ClientOperation{
    78  		ID:                 "actionGetJobLog",
    79  		Method:             "GET",
    80  		PathPattern:        "/jobservice/jobs/{job_id}/log",
    81  		ProducesMediaTypes: []string{"text/plain"},
    82  		ConsumesMediaTypes: []string{"application/json"},
    83  		Schemes:            []string{"http", "https"},
    84  		Params:             params,
    85  		Reader:             &ActionGetJobLogReader{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.(*ActionGetJobLogOK), nil
    94  
    95  }
    96  
    97  /*
    98  ActionPendingJobs stops and clean pause resume pending jobs in the queue
    99  
   100  stop and clean, pause, resume pending jobs in the queue
   101  */
   102  func (a *Client) ActionPendingJobs(ctx context.Context, params *ActionPendingJobsParams) (*ActionPendingJobsOK, error) {
   103  
   104  	result, err := a.transport.Submit(&runtime.ClientOperation{
   105  		ID:                 "actionPendingJobs",
   106  		Method:             "PUT",
   107  		PathPattern:        "/jobservice/queues/{job_type}",
   108  		ProducesMediaTypes: []string{"application/json"},
   109  		ConsumesMediaTypes: []string{"application/json"},
   110  		Schemes:            []string{"http", "https"},
   111  		Params:             params,
   112  		Reader:             &ActionPendingJobsReader{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.(*ActionPendingJobsOK), nil
   121  
   122  }
   123  
   124  /*
   125  GetWorkerPools gets worker pools
   126  
   127  Get worker pools
   128  */
   129  func (a *Client) GetWorkerPools(ctx context.Context, params *GetWorkerPoolsParams) (*GetWorkerPoolsOK, error) {
   130  
   131  	result, err := a.transport.Submit(&runtime.ClientOperation{
   132  		ID:                 "getWorkerPools",
   133  		Method:             "GET",
   134  		PathPattern:        "/jobservice/pools",
   135  		ProducesMediaTypes: []string{"application/json"},
   136  		ConsumesMediaTypes: []string{"application/json"},
   137  		Schemes:            []string{"http", "https"},
   138  		Params:             params,
   139  		Reader:             &GetWorkerPoolsReader{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.(*GetWorkerPoolsOK), nil
   148  
   149  }
   150  
   151  /*
   152  GetWorkers gets workers
   153  
   154  Get workers in current pool
   155  */
   156  func (a *Client) GetWorkers(ctx context.Context, params *GetWorkersParams) (*GetWorkersOK, error) {
   157  
   158  	result, err := a.transport.Submit(&runtime.ClientOperation{
   159  		ID:                 "getWorkers",
   160  		Method:             "GET",
   161  		PathPattern:        "/jobservice/pools/{pool_id}/workers",
   162  		ProducesMediaTypes: []string{"application/json"},
   163  		ConsumesMediaTypes: []string{"application/json"},
   164  		Schemes:            []string{"http", "https"},
   165  		Params:             params,
   166  		Reader:             &GetWorkersReader{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.(*GetWorkersOK), nil
   175  
   176  }
   177  
   178  /*
   179  ListJobQueues lists job queues
   180  
   181  list job queue
   182  */
   183  func (a *Client) ListJobQueues(ctx context.Context, params *ListJobQueuesParams) (*ListJobQueuesOK, error) {
   184  
   185  	result, err := a.transport.Submit(&runtime.ClientOperation{
   186  		ID:                 "listJobQueues",
   187  		Method:             "GET",
   188  		PathPattern:        "/jobservice/queues",
   189  		ProducesMediaTypes: []string{"application/json"},
   190  		ConsumesMediaTypes: []string{"application/json"},
   191  		Schemes:            []string{"http", "https"},
   192  		Params:             params,
   193  		Reader:             &ListJobQueuesReader{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.(*ListJobQueuesOK), nil
   202  
   203  }
   204  
   205  /*
   206  StopRunningJob stops running job
   207  
   208  Stop running job
   209  */
   210  func (a *Client) StopRunningJob(ctx context.Context, params *StopRunningJobParams) (*StopRunningJobOK, error) {
   211  
   212  	result, err := a.transport.Submit(&runtime.ClientOperation{
   213  		ID:                 "stopRunningJob",
   214  		Method:             "PUT",
   215  		PathPattern:        "/jobservice/jobs/{job_id}",
   216  		ProducesMediaTypes: []string{"application/json"},
   217  		ConsumesMediaTypes: []string{"application/json"},
   218  		Schemes:            []string{"http", "https"},
   219  		Params:             params,
   220  		Reader:             &StopRunningJobReader{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.(*StopRunningJobOK), nil
   229  
   230  }