github.com/cilium/cilium@v1.16.2/api/v1/client/recorder/recorder_client.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  // Copyright Authors of Cilium
     4  // SPDX-License-Identifier: Apache-2.0
     5  
     6  package recorder
     7  
     8  // This file was generated by the swagger tool.
     9  // Editing this file might prove futile when you re-run the swagger generate command
    10  
    11  import (
    12  	"fmt"
    13  
    14  	"github.com/go-openapi/runtime"
    15  	"github.com/go-openapi/strfmt"
    16  )
    17  
    18  // New creates a new recorder API client.
    19  func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
    20  	return &Client{transport: transport, formats: formats}
    21  }
    22  
    23  /*
    24  Client for recorder API
    25  */
    26  type Client struct {
    27  	transport runtime.ClientTransport
    28  	formats   strfmt.Registry
    29  }
    30  
    31  // ClientOption is the option for Client methods
    32  type ClientOption func(*runtime.ClientOperation)
    33  
    34  // ClientService is the interface for Client methods
    35  type ClientService interface {
    36  	DeleteRecorderID(params *DeleteRecorderIDParams, opts ...ClientOption) (*DeleteRecorderIDOK, error)
    37  
    38  	GetRecorder(params *GetRecorderParams, opts ...ClientOption) (*GetRecorderOK, error)
    39  
    40  	GetRecorderID(params *GetRecorderIDParams, opts ...ClientOption) (*GetRecorderIDOK, error)
    41  
    42  	GetRecorderMasks(params *GetRecorderMasksParams, opts ...ClientOption) (*GetRecorderMasksOK, error)
    43  
    44  	PutRecorderID(params *PutRecorderIDParams, opts ...ClientOption) (*PutRecorderIDOK, *PutRecorderIDCreated, error)
    45  
    46  	SetTransport(transport runtime.ClientTransport)
    47  }
    48  
    49  /*
    50  DeleteRecorderID deletes a recorder
    51  */
    52  func (a *Client) DeleteRecorderID(params *DeleteRecorderIDParams, opts ...ClientOption) (*DeleteRecorderIDOK, error) {
    53  	// TODO: Validate the params before sending
    54  	if params == nil {
    55  		params = NewDeleteRecorderIDParams()
    56  	}
    57  	op := &runtime.ClientOperation{
    58  		ID:                 "DeleteRecorderID",
    59  		Method:             "DELETE",
    60  		PathPattern:        "/recorder/{id}",
    61  		ProducesMediaTypes: []string{"application/json"},
    62  		ConsumesMediaTypes: []string{"application/json"},
    63  		Schemes:            []string{"http"},
    64  		Params:             params,
    65  		Reader:             &DeleteRecorderIDReader{formats: a.formats},
    66  		Context:            params.Context,
    67  		Client:             params.HTTPClient,
    68  	}
    69  	for _, opt := range opts {
    70  		opt(op)
    71  	}
    72  
    73  	result, err := a.transport.Submit(op)
    74  	if err != nil {
    75  		return nil, err
    76  	}
    77  	success, ok := result.(*DeleteRecorderIDOK)
    78  	if ok {
    79  		return success, nil
    80  	}
    81  	// unexpected success response
    82  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
    83  	msg := fmt.Sprintf("unexpected success response for DeleteRecorderID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
    84  	panic(msg)
    85  }
    86  
    87  /*
    88  GetRecorder retrieves list of all recorders
    89  */
    90  func (a *Client) GetRecorder(params *GetRecorderParams, opts ...ClientOption) (*GetRecorderOK, error) {
    91  	// TODO: Validate the params before sending
    92  	if params == nil {
    93  		params = NewGetRecorderParams()
    94  	}
    95  	op := &runtime.ClientOperation{
    96  		ID:                 "GetRecorder",
    97  		Method:             "GET",
    98  		PathPattern:        "/recorder",
    99  		ProducesMediaTypes: []string{"application/json"},
   100  		ConsumesMediaTypes: []string{"application/json"},
   101  		Schemes:            []string{"http"},
   102  		Params:             params,
   103  		Reader:             &GetRecorderReader{formats: a.formats},
   104  		Context:            params.Context,
   105  		Client:             params.HTTPClient,
   106  	}
   107  	for _, opt := range opts {
   108  		opt(op)
   109  	}
   110  
   111  	result, err := a.transport.Submit(op)
   112  	if err != nil {
   113  		return nil, err
   114  	}
   115  	success, ok := result.(*GetRecorderOK)
   116  	if ok {
   117  		return success, nil
   118  	}
   119  	// unexpected success response
   120  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   121  	msg := fmt.Sprintf("unexpected success response for GetRecorder: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   122  	panic(msg)
   123  }
   124  
   125  /*
   126  GetRecorderID retrieves configuration of a recorder
   127  */
   128  func (a *Client) GetRecorderID(params *GetRecorderIDParams, opts ...ClientOption) (*GetRecorderIDOK, error) {
   129  	// TODO: Validate the params before sending
   130  	if params == nil {
   131  		params = NewGetRecorderIDParams()
   132  	}
   133  	op := &runtime.ClientOperation{
   134  		ID:                 "GetRecorderID",
   135  		Method:             "GET",
   136  		PathPattern:        "/recorder/{id}",
   137  		ProducesMediaTypes: []string{"application/json"},
   138  		ConsumesMediaTypes: []string{"application/json"},
   139  		Schemes:            []string{"http"},
   140  		Params:             params,
   141  		Reader:             &GetRecorderIDReader{formats: a.formats},
   142  		Context:            params.Context,
   143  		Client:             params.HTTPClient,
   144  	}
   145  	for _, opt := range opts {
   146  		opt(op)
   147  	}
   148  
   149  	result, err := a.transport.Submit(op)
   150  	if err != nil {
   151  		return nil, err
   152  	}
   153  	success, ok := result.(*GetRecorderIDOK)
   154  	if ok {
   155  		return success, nil
   156  	}
   157  	// unexpected success response
   158  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   159  	msg := fmt.Sprintf("unexpected success response for GetRecorderID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   160  	panic(msg)
   161  }
   162  
   163  /*
   164  GetRecorderMasks retrieves list of all recorder masks
   165  */
   166  func (a *Client) GetRecorderMasks(params *GetRecorderMasksParams, opts ...ClientOption) (*GetRecorderMasksOK, error) {
   167  	// TODO: Validate the params before sending
   168  	if params == nil {
   169  		params = NewGetRecorderMasksParams()
   170  	}
   171  	op := &runtime.ClientOperation{
   172  		ID:                 "GetRecorderMasks",
   173  		Method:             "GET",
   174  		PathPattern:        "/recorder/masks",
   175  		ProducesMediaTypes: []string{"application/json"},
   176  		ConsumesMediaTypes: []string{"application/json"},
   177  		Schemes:            []string{"http"},
   178  		Params:             params,
   179  		Reader:             &GetRecorderMasksReader{formats: a.formats},
   180  		Context:            params.Context,
   181  		Client:             params.HTTPClient,
   182  	}
   183  	for _, opt := range opts {
   184  		opt(op)
   185  	}
   186  
   187  	result, err := a.transport.Submit(op)
   188  	if err != nil {
   189  		return nil, err
   190  	}
   191  	success, ok := result.(*GetRecorderMasksOK)
   192  	if ok {
   193  		return success, nil
   194  	}
   195  	// unexpected success response
   196  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   197  	msg := fmt.Sprintf("unexpected success response for GetRecorderMasks: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   198  	panic(msg)
   199  }
   200  
   201  /*
   202  PutRecorderID creates or update recorder
   203  */
   204  func (a *Client) PutRecorderID(params *PutRecorderIDParams, opts ...ClientOption) (*PutRecorderIDOK, *PutRecorderIDCreated, error) {
   205  	// TODO: Validate the params before sending
   206  	if params == nil {
   207  		params = NewPutRecorderIDParams()
   208  	}
   209  	op := &runtime.ClientOperation{
   210  		ID:                 "PutRecorderID",
   211  		Method:             "PUT",
   212  		PathPattern:        "/recorder/{id}",
   213  		ProducesMediaTypes: []string{"application/json"},
   214  		ConsumesMediaTypes: []string{"application/json"},
   215  		Schemes:            []string{"http"},
   216  		Params:             params,
   217  		Reader:             &PutRecorderIDReader{formats: a.formats},
   218  		Context:            params.Context,
   219  		Client:             params.HTTPClient,
   220  	}
   221  	for _, opt := range opts {
   222  		opt(op)
   223  	}
   224  
   225  	result, err := a.transport.Submit(op)
   226  	if err != nil {
   227  		return nil, nil, err
   228  	}
   229  	switch value := result.(type) {
   230  	case *PutRecorderIDOK:
   231  		return value, nil, nil
   232  	case *PutRecorderIDCreated:
   233  		return nil, value, nil
   234  	}
   235  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   236  	msg := fmt.Sprintf("unexpected success response for recorder: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   237  	panic(msg)
   238  }
   239  
   240  // SetTransport changes the transport on the client
   241  func (a *Client) SetTransport(transport runtime.ClientTransport) {
   242  	a.transport = transport
   243  }