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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package gc
     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 gc client
    19  type API interface {
    20  	/*
    21  	   CreateGCSchedule creates a gc schedule
    22  
    23  	   This endpoint is for update gc schedule.
    24  	*/
    25  	CreateGCSchedule(ctx context.Context, params *CreateGCScheduleParams) (*CreateGCScheduleCreated, error)
    26  	/*
    27  	   GetGC gets gc status
    28  
    29  	   This endpoint let user get gc status filtered by specific ID.*/
    30  	GetGC(ctx context.Context, params *GetGCParams) (*GetGCOK, error)
    31  	/*
    32  	   GetGCHistory gets gc results
    33  
    34  	   This endpoint let user get gc execution history.*/
    35  	GetGCHistory(ctx context.Context, params *GetGCHistoryParams) (*GetGCHistoryOK, error)
    36  	/*
    37  	   GetGCLog gets gc job log
    38  
    39  	   This endpoint let user get gc job logs filtered by specific ID.*/
    40  	GetGCLog(ctx context.Context, params *GetGCLogParams) (*GetGCLogOK, error)
    41  	/*
    42  	   GetGCSchedule gets gc s schedule
    43  
    44  	   This endpoint is for get schedule of gc job.*/
    45  	GetGCSchedule(ctx context.Context, params *GetGCScheduleParams) (*GetGCScheduleOK, error)
    46  	/*
    47  	   StopGC stops the specific GC execution
    48  
    49  	   Stop the GC execution specified by ID*/
    50  	StopGC(ctx context.Context, params *StopGCParams) (*StopGCOK, error)
    51  	/*
    52  	   UpdateGCSchedule updates gc s schedule
    53  
    54  	   This endpoint is for update gc schedule.
    55  	*/
    56  	UpdateGCSchedule(ctx context.Context, params *UpdateGCScheduleParams) (*UpdateGCScheduleOK, error)
    57  }
    58  
    59  // New creates a new gc API client.
    60  func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client {
    61  	return &Client{
    62  		transport: transport,
    63  		formats:   formats,
    64  		authInfo:  authInfo,
    65  	}
    66  }
    67  
    68  /*
    69  Client for gc API
    70  */
    71  type Client struct {
    72  	transport runtime.ClientTransport
    73  	formats   strfmt.Registry
    74  	authInfo  runtime.ClientAuthInfoWriter
    75  }
    76  
    77  /*
    78  CreateGCSchedule creates a gc schedule
    79  
    80  This endpoint is for update gc schedule.
    81  */
    82  func (a *Client) CreateGCSchedule(ctx context.Context, params *CreateGCScheduleParams) (*CreateGCScheduleCreated, error) {
    83  
    84  	result, err := a.transport.Submit(&runtime.ClientOperation{
    85  		ID:                 "createGCSchedule",
    86  		Method:             "POST",
    87  		PathPattern:        "/system/gc/schedule",
    88  		ProducesMediaTypes: []string{"application/json"},
    89  		ConsumesMediaTypes: []string{"application/json"},
    90  		Schemes:            []string{"http", "https"},
    91  		Params:             params,
    92  		Reader:             &CreateGCScheduleReader{formats: a.formats},
    93  		AuthInfo:           a.authInfo,
    94  		Context:            ctx,
    95  		Client:             params.HTTPClient,
    96  	})
    97  	if err != nil {
    98  		return nil, err
    99  	}
   100  	return result.(*CreateGCScheduleCreated), nil
   101  
   102  }
   103  
   104  /*
   105  GetGC gets gc status
   106  
   107  This endpoint let user get gc status filtered by specific ID.
   108  */
   109  func (a *Client) GetGC(ctx context.Context, params *GetGCParams) (*GetGCOK, error) {
   110  
   111  	result, err := a.transport.Submit(&runtime.ClientOperation{
   112  		ID:                 "getGC",
   113  		Method:             "GET",
   114  		PathPattern:        "/system/gc/{gc_id}",
   115  		ProducesMediaTypes: []string{"application/json"},
   116  		ConsumesMediaTypes: []string{"application/json"},
   117  		Schemes:            []string{"http", "https"},
   118  		Params:             params,
   119  		Reader:             &GetGCReader{formats: a.formats},
   120  		AuthInfo:           a.authInfo,
   121  		Context:            ctx,
   122  		Client:             params.HTTPClient,
   123  	})
   124  	if err != nil {
   125  		return nil, err
   126  	}
   127  	return result.(*GetGCOK), nil
   128  
   129  }
   130  
   131  /*
   132  GetGCHistory gets gc results
   133  
   134  This endpoint let user get gc execution history.
   135  */
   136  func (a *Client) GetGCHistory(ctx context.Context, params *GetGCHistoryParams) (*GetGCHistoryOK, error) {
   137  
   138  	result, err := a.transport.Submit(&runtime.ClientOperation{
   139  		ID:                 "getGCHistory",
   140  		Method:             "GET",
   141  		PathPattern:        "/system/gc",
   142  		ProducesMediaTypes: []string{"application/json"},
   143  		ConsumesMediaTypes: []string{"application/json"},
   144  		Schemes:            []string{"http", "https"},
   145  		Params:             params,
   146  		Reader:             &GetGCHistoryReader{formats: a.formats},
   147  		AuthInfo:           a.authInfo,
   148  		Context:            ctx,
   149  		Client:             params.HTTPClient,
   150  	})
   151  	if err != nil {
   152  		return nil, err
   153  	}
   154  	return result.(*GetGCHistoryOK), nil
   155  
   156  }
   157  
   158  /*
   159  GetGCLog gets gc job log
   160  
   161  This endpoint let user get gc job logs filtered by specific ID.
   162  */
   163  func (a *Client) GetGCLog(ctx context.Context, params *GetGCLogParams) (*GetGCLogOK, error) {
   164  
   165  	result, err := a.transport.Submit(&runtime.ClientOperation{
   166  		ID:                 "getGCLog",
   167  		Method:             "GET",
   168  		PathPattern:        "/system/gc/{gc_id}/log",
   169  		ProducesMediaTypes: []string{"text/plain"},
   170  		ConsumesMediaTypes: []string{"application/json"},
   171  		Schemes:            []string{"http", "https"},
   172  		Params:             params,
   173  		Reader:             &GetGCLogReader{formats: a.formats},
   174  		AuthInfo:           a.authInfo,
   175  		Context:            ctx,
   176  		Client:             params.HTTPClient,
   177  	})
   178  	if err != nil {
   179  		return nil, err
   180  	}
   181  	return result.(*GetGCLogOK), nil
   182  
   183  }
   184  
   185  /*
   186  GetGCSchedule gets gc s schedule
   187  
   188  This endpoint is for get schedule of gc job.
   189  */
   190  func (a *Client) GetGCSchedule(ctx context.Context, params *GetGCScheduleParams) (*GetGCScheduleOK, error) {
   191  
   192  	result, err := a.transport.Submit(&runtime.ClientOperation{
   193  		ID:                 "getGCSchedule",
   194  		Method:             "GET",
   195  		PathPattern:        "/system/gc/schedule",
   196  		ProducesMediaTypes: []string{"application/json"},
   197  		ConsumesMediaTypes: []string{"application/json"},
   198  		Schemes:            []string{"http", "https"},
   199  		Params:             params,
   200  		Reader:             &GetGCScheduleReader{formats: a.formats},
   201  		AuthInfo:           a.authInfo,
   202  		Context:            ctx,
   203  		Client:             params.HTTPClient,
   204  	})
   205  	if err != nil {
   206  		return nil, err
   207  	}
   208  	return result.(*GetGCScheduleOK), nil
   209  
   210  }
   211  
   212  /*
   213  StopGC stops the specific GC execution
   214  
   215  Stop the GC execution specified by ID
   216  */
   217  func (a *Client) StopGC(ctx context.Context, params *StopGCParams) (*StopGCOK, error) {
   218  
   219  	result, err := a.transport.Submit(&runtime.ClientOperation{
   220  		ID:                 "stopGC",
   221  		Method:             "PUT",
   222  		PathPattern:        "/system/gc/{gc_id}",
   223  		ProducesMediaTypes: []string{"application/json"},
   224  		ConsumesMediaTypes: []string{"application/json"},
   225  		Schemes:            []string{"http", "https"},
   226  		Params:             params,
   227  		Reader:             &StopGCReader{formats: a.formats},
   228  		AuthInfo:           a.authInfo,
   229  		Context:            ctx,
   230  		Client:             params.HTTPClient,
   231  	})
   232  	if err != nil {
   233  		return nil, err
   234  	}
   235  	return result.(*StopGCOK), nil
   236  
   237  }
   238  
   239  /*
   240  UpdateGCSchedule updates gc s schedule
   241  
   242  This endpoint is for update gc schedule.
   243  */
   244  func (a *Client) UpdateGCSchedule(ctx context.Context, params *UpdateGCScheduleParams) (*UpdateGCScheduleOK, error) {
   245  
   246  	result, err := a.transport.Submit(&runtime.ClientOperation{
   247  		ID:                 "updateGCSchedule",
   248  		Method:             "PUT",
   249  		PathPattern:        "/system/gc/schedule",
   250  		ProducesMediaTypes: []string{"application/json"},
   251  		ConsumesMediaTypes: []string{"application/json"},
   252  		Schemes:            []string{"http", "https"},
   253  		Params:             params,
   254  		Reader:             &UpdateGCScheduleReader{formats: a.formats},
   255  		AuthInfo:           a.authInfo,
   256  		Context:            ctx,
   257  		Client:             params.HTTPClient,
   258  	})
   259  	if err != nil {
   260  		return nil, err
   261  	}
   262  	return result.(*UpdateGCScheduleOK), nil
   263  
   264  }