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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package robot
     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 robot client
    19  type API interface {
    20  	/*
    21  	   CreateRobot creates a robot account
    22  
    23  	   Create a robot account*/
    24  	CreateRobot(ctx context.Context, params *CreateRobotParams) (*CreateRobotCreated, error)
    25  	/*
    26  	   DeleteRobot deletes a robot account
    27  
    28  	   This endpoint deletes specific robot account information by robot ID.*/
    29  	DeleteRobot(ctx context.Context, params *DeleteRobotParams) (*DeleteRobotOK, error)
    30  	/*
    31  	   GetRobotByID gets a robot account
    32  
    33  	   This endpoint returns specific robot account information by robot ID.*/
    34  	GetRobotByID(ctx context.Context, params *GetRobotByIDParams) (*GetRobotByIDOK, error)
    35  	/*
    36  	   ListRobot gets robot account
    37  
    38  	   List the robot accounts with the specified level and project.*/
    39  	ListRobot(ctx context.Context, params *ListRobotParams) (*ListRobotOK, error)
    40  	/*
    41  	   RefreshSec refreshes the robot secret
    42  
    43  	   Refresh the robot secret*/
    44  	RefreshSec(ctx context.Context, params *RefreshSecParams) (*RefreshSecOK, error)
    45  	/*
    46  	   UpdateRobot updates a robot account
    47  
    48  	   This endpoint updates specific robot account information by robot ID.*/
    49  	UpdateRobot(ctx context.Context, params *UpdateRobotParams) (*UpdateRobotOK, error)
    50  }
    51  
    52  // New creates a new robot 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 robot API
    63  */
    64  type Client struct {
    65  	transport runtime.ClientTransport
    66  	formats   strfmt.Registry
    67  	authInfo  runtime.ClientAuthInfoWriter
    68  }
    69  
    70  /*
    71  CreateRobot creates a robot account
    72  
    73  Create a robot account
    74  */
    75  func (a *Client) CreateRobot(ctx context.Context, params *CreateRobotParams) (*CreateRobotCreated, error) {
    76  
    77  	result, err := a.transport.Submit(&runtime.ClientOperation{
    78  		ID:                 "CreateRobot",
    79  		Method:             "POST",
    80  		PathPattern:        "/robots",
    81  		ProducesMediaTypes: []string{"application/json"},
    82  		ConsumesMediaTypes: []string{"application/json"},
    83  		Schemes:            []string{"http", "https"},
    84  		Params:             params,
    85  		Reader:             &CreateRobotReader{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.(*CreateRobotCreated), nil
    94  
    95  }
    96  
    97  /*
    98  DeleteRobot deletes a robot account
    99  
   100  This endpoint deletes specific robot account information by robot ID.
   101  */
   102  func (a *Client) DeleteRobot(ctx context.Context, params *DeleteRobotParams) (*DeleteRobotOK, error) {
   103  
   104  	result, err := a.transport.Submit(&runtime.ClientOperation{
   105  		ID:                 "DeleteRobot",
   106  		Method:             "DELETE",
   107  		PathPattern:        "/robots/{robot_id}",
   108  		ProducesMediaTypes: []string{"application/json"},
   109  		ConsumesMediaTypes: []string{"application/json"},
   110  		Schemes:            []string{"http", "https"},
   111  		Params:             params,
   112  		Reader:             &DeleteRobotReader{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.(*DeleteRobotOK), nil
   121  
   122  }
   123  
   124  /*
   125  GetRobotByID gets a robot account
   126  
   127  This endpoint returns specific robot account information by robot ID.
   128  */
   129  func (a *Client) GetRobotByID(ctx context.Context, params *GetRobotByIDParams) (*GetRobotByIDOK, error) {
   130  
   131  	result, err := a.transport.Submit(&runtime.ClientOperation{
   132  		ID:                 "GetRobotByID",
   133  		Method:             "GET",
   134  		PathPattern:        "/robots/{robot_id}",
   135  		ProducesMediaTypes: []string{"application/json"},
   136  		ConsumesMediaTypes: []string{"application/json"},
   137  		Schemes:            []string{"http", "https"},
   138  		Params:             params,
   139  		Reader:             &GetRobotByIDReader{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.(*GetRobotByIDOK), nil
   148  
   149  }
   150  
   151  /*
   152  ListRobot gets robot account
   153  
   154  List the robot accounts with the specified level and project.
   155  */
   156  func (a *Client) ListRobot(ctx context.Context, params *ListRobotParams) (*ListRobotOK, error) {
   157  
   158  	result, err := a.transport.Submit(&runtime.ClientOperation{
   159  		ID:                 "ListRobot",
   160  		Method:             "GET",
   161  		PathPattern:        "/robots",
   162  		ProducesMediaTypes: []string{"application/json"},
   163  		ConsumesMediaTypes: []string{"application/json"},
   164  		Schemes:            []string{"http", "https"},
   165  		Params:             params,
   166  		Reader:             &ListRobotReader{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.(*ListRobotOK), nil
   175  
   176  }
   177  
   178  /*
   179  RefreshSec refreshes the robot secret
   180  
   181  Refresh the robot secret
   182  */
   183  func (a *Client) RefreshSec(ctx context.Context, params *RefreshSecParams) (*RefreshSecOK, error) {
   184  
   185  	result, err := a.transport.Submit(&runtime.ClientOperation{
   186  		ID:                 "RefreshSec",
   187  		Method:             "PATCH",
   188  		PathPattern:        "/robots/{robot_id}",
   189  		ProducesMediaTypes: []string{"application/json"},
   190  		ConsumesMediaTypes: []string{"application/json"},
   191  		Schemes:            []string{"http", "https"},
   192  		Params:             params,
   193  		Reader:             &RefreshSecReader{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.(*RefreshSecOK), nil
   202  
   203  }
   204  
   205  /*
   206  UpdateRobot updates a robot account
   207  
   208  This endpoint updates specific robot account information by robot ID.
   209  */
   210  func (a *Client) UpdateRobot(ctx context.Context, params *UpdateRobotParams) (*UpdateRobotOK, error) {
   211  
   212  	result, err := a.transport.Submit(&runtime.ClientOperation{
   213  		ID:                 "UpdateRobot",
   214  		Method:             "PUT",
   215  		PathPattern:        "/robots/{robot_id}",
   216  		ProducesMediaTypes: []string{"application/json"},
   217  		ConsumesMediaTypes: []string{"application/json"},
   218  		Schemes:            []string{"http", "https"},
   219  		Params:             params,
   220  		Reader:             &UpdateRobotReader{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.(*UpdateRobotOK), nil
   229  
   230  }