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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package robotv1
     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 robotv1 client
    19  type API interface {
    20  	/*
    21  	   CreateRobotV1 creates a robot account
    22  
    23  	   Create a robot account*/
    24  	CreateRobotV1(ctx context.Context, params *CreateRobotV1Params) (*CreateRobotV1Created, error)
    25  	/*
    26  	   DeleteRobotV1 deletes a robot account
    27  
    28  	   This endpoint deletes specific robot account information by robot ID.*/
    29  	DeleteRobotV1(ctx context.Context, params *DeleteRobotV1Params) (*DeleteRobotV1OK, error)
    30  	/*
    31  	   GetRobotByIDV1 gets a robot account
    32  
    33  	   This endpoint returns specific robot account information by robot ID.*/
    34  	GetRobotByIDV1(ctx context.Context, params *GetRobotByIDV1Params) (*GetRobotByIDV1OK, error)
    35  	/*
    36  	   ListRobotV1 gets all robot accounts of specified project
    37  
    38  	   Get all robot accounts of specified project*/
    39  	ListRobotV1(ctx context.Context, params *ListRobotV1Params) (*ListRobotV1OK, error)
    40  	/*
    41  	   UpdateRobotV1 updates status of robot account
    42  
    43  	   Used to disable/enable a specified robot account.*/
    44  	UpdateRobotV1(ctx context.Context, params *UpdateRobotV1Params) (*UpdateRobotV1OK, error)
    45  }
    46  
    47  // New creates a new robotv1 API client.
    48  func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client {
    49  	return &Client{
    50  		transport: transport,
    51  		formats:   formats,
    52  		authInfo:  authInfo,
    53  	}
    54  }
    55  
    56  /*
    57  Client for robotv1 API
    58  */
    59  type Client struct {
    60  	transport runtime.ClientTransport
    61  	formats   strfmt.Registry
    62  	authInfo  runtime.ClientAuthInfoWriter
    63  }
    64  
    65  /*
    66  CreateRobotV1 creates a robot account
    67  
    68  Create a robot account
    69  */
    70  func (a *Client) CreateRobotV1(ctx context.Context, params *CreateRobotV1Params) (*CreateRobotV1Created, error) {
    71  
    72  	result, err := a.transport.Submit(&runtime.ClientOperation{
    73  		ID:                 "CreateRobotV1",
    74  		Method:             "POST",
    75  		PathPattern:        "/projects/{project_name_or_id}/robots",
    76  		ProducesMediaTypes: []string{"application/json"},
    77  		ConsumesMediaTypes: []string{"application/json"},
    78  		Schemes:            []string{"http", "https"},
    79  		Params:             params,
    80  		Reader:             &CreateRobotV1Reader{formats: a.formats},
    81  		AuthInfo:           a.authInfo,
    82  		Context:            ctx,
    83  		Client:             params.HTTPClient,
    84  	})
    85  	if err != nil {
    86  		return nil, err
    87  	}
    88  	return result.(*CreateRobotV1Created), nil
    89  
    90  }
    91  
    92  /*
    93  DeleteRobotV1 deletes a robot account
    94  
    95  This endpoint deletes specific robot account information by robot ID.
    96  */
    97  func (a *Client) DeleteRobotV1(ctx context.Context, params *DeleteRobotV1Params) (*DeleteRobotV1OK, error) {
    98  
    99  	result, err := a.transport.Submit(&runtime.ClientOperation{
   100  		ID:                 "DeleteRobotV1",
   101  		Method:             "DELETE",
   102  		PathPattern:        "/projects/{project_name_or_id}/robots/{robot_id}",
   103  		ProducesMediaTypes: []string{"application/json"},
   104  		ConsumesMediaTypes: []string{"application/json"},
   105  		Schemes:            []string{"http", "https"},
   106  		Params:             params,
   107  		Reader:             &DeleteRobotV1Reader{formats: a.formats},
   108  		AuthInfo:           a.authInfo,
   109  		Context:            ctx,
   110  		Client:             params.HTTPClient,
   111  	})
   112  	if err != nil {
   113  		return nil, err
   114  	}
   115  	return result.(*DeleteRobotV1OK), nil
   116  
   117  }
   118  
   119  /*
   120  GetRobotByIDV1 gets a robot account
   121  
   122  This endpoint returns specific robot account information by robot ID.
   123  */
   124  func (a *Client) GetRobotByIDV1(ctx context.Context, params *GetRobotByIDV1Params) (*GetRobotByIDV1OK, error) {
   125  
   126  	result, err := a.transport.Submit(&runtime.ClientOperation{
   127  		ID:                 "GetRobotByIDV1",
   128  		Method:             "GET",
   129  		PathPattern:        "/projects/{project_name_or_id}/robots/{robot_id}",
   130  		ProducesMediaTypes: []string{"application/json"},
   131  		ConsumesMediaTypes: []string{"application/json"},
   132  		Schemes:            []string{"http", "https"},
   133  		Params:             params,
   134  		Reader:             &GetRobotByIDV1Reader{formats: a.formats},
   135  		AuthInfo:           a.authInfo,
   136  		Context:            ctx,
   137  		Client:             params.HTTPClient,
   138  	})
   139  	if err != nil {
   140  		return nil, err
   141  	}
   142  	return result.(*GetRobotByIDV1OK), nil
   143  
   144  }
   145  
   146  /*
   147  ListRobotV1 gets all robot accounts of specified project
   148  
   149  Get all robot accounts of specified project
   150  */
   151  func (a *Client) ListRobotV1(ctx context.Context, params *ListRobotV1Params) (*ListRobotV1OK, error) {
   152  
   153  	result, err := a.transport.Submit(&runtime.ClientOperation{
   154  		ID:                 "ListRobotV1",
   155  		Method:             "GET",
   156  		PathPattern:        "/projects/{project_name_or_id}/robots",
   157  		ProducesMediaTypes: []string{"application/json"},
   158  		ConsumesMediaTypes: []string{"application/json"},
   159  		Schemes:            []string{"http", "https"},
   160  		Params:             params,
   161  		Reader:             &ListRobotV1Reader{formats: a.formats},
   162  		AuthInfo:           a.authInfo,
   163  		Context:            ctx,
   164  		Client:             params.HTTPClient,
   165  	})
   166  	if err != nil {
   167  		return nil, err
   168  	}
   169  	return result.(*ListRobotV1OK), nil
   170  
   171  }
   172  
   173  /*
   174  UpdateRobotV1 updates status of robot account
   175  
   176  Used to disable/enable a specified robot account.
   177  */
   178  func (a *Client) UpdateRobotV1(ctx context.Context, params *UpdateRobotV1Params) (*UpdateRobotV1OK, error) {
   179  
   180  	result, err := a.transport.Submit(&runtime.ClientOperation{
   181  		ID:                 "UpdateRobotV1",
   182  		Method:             "PUT",
   183  		PathPattern:        "/projects/{project_name_or_id}/robots/{robot_id}",
   184  		ProducesMediaTypes: []string{"application/json"},
   185  		ConsumesMediaTypes: []string{"application/json"},
   186  		Schemes:            []string{"http", "https"},
   187  		Params:             params,
   188  		Reader:             &UpdateRobotV1Reader{formats: a.formats},
   189  		AuthInfo:           a.authInfo,
   190  		Context:            ctx,
   191  		Client:             params.HTTPClient,
   192  	})
   193  	if err != nil {
   194  		return nil, err
   195  	}
   196  	return result.(*UpdateRobotV1OK), nil
   197  
   198  }