github.com/cilium/cilium@v1.16.2/api/v1/client/endpoint/endpoint_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 endpoint
     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 endpoint 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 endpoint 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  	DeleteEndpoint(params *DeleteEndpointParams, opts ...ClientOption) (*DeleteEndpointOK, *DeleteEndpointErrors, error)
    37  
    38  	DeleteEndpointID(params *DeleteEndpointIDParams, opts ...ClientOption) (*DeleteEndpointIDOK, *DeleteEndpointIDErrors, error)
    39  
    40  	GetEndpoint(params *GetEndpointParams, opts ...ClientOption) (*GetEndpointOK, error)
    41  
    42  	GetEndpointID(params *GetEndpointIDParams, opts ...ClientOption) (*GetEndpointIDOK, error)
    43  
    44  	GetEndpointIDConfig(params *GetEndpointIDConfigParams, opts ...ClientOption) (*GetEndpointIDConfigOK, error)
    45  
    46  	GetEndpointIDHealthz(params *GetEndpointIDHealthzParams, opts ...ClientOption) (*GetEndpointIDHealthzOK, error)
    47  
    48  	GetEndpointIDLabels(params *GetEndpointIDLabelsParams, opts ...ClientOption) (*GetEndpointIDLabelsOK, error)
    49  
    50  	GetEndpointIDLog(params *GetEndpointIDLogParams, opts ...ClientOption) (*GetEndpointIDLogOK, error)
    51  
    52  	PatchEndpointID(params *PatchEndpointIDParams, opts ...ClientOption) (*PatchEndpointIDOK, error)
    53  
    54  	PatchEndpointIDConfig(params *PatchEndpointIDConfigParams, opts ...ClientOption) (*PatchEndpointIDConfigOK, error)
    55  
    56  	PatchEndpointIDLabels(params *PatchEndpointIDLabelsParams, opts ...ClientOption) (*PatchEndpointIDLabelsOK, error)
    57  
    58  	PutEndpointID(params *PutEndpointIDParams, opts ...ClientOption) (*PutEndpointIDCreated, error)
    59  
    60  	SetTransport(transport runtime.ClientTransport)
    61  }
    62  
    63  /*
    64  DeleteEndpoint deletes a list of endpoints
    65  
    66  Deletes a list of endpoints that have endpoints matching the provided properties
    67  */
    68  func (a *Client) DeleteEndpoint(params *DeleteEndpointParams, opts ...ClientOption) (*DeleteEndpointOK, *DeleteEndpointErrors, error) {
    69  	// TODO: Validate the params before sending
    70  	if params == nil {
    71  		params = NewDeleteEndpointParams()
    72  	}
    73  	op := &runtime.ClientOperation{
    74  		ID:                 "DeleteEndpoint",
    75  		Method:             "DELETE",
    76  		PathPattern:        "/endpoint",
    77  		ProducesMediaTypes: []string{"application/json"},
    78  		ConsumesMediaTypes: []string{"application/json"},
    79  		Schemes:            []string{"http"},
    80  		Params:             params,
    81  		Reader:             &DeleteEndpointReader{formats: a.formats},
    82  		Context:            params.Context,
    83  		Client:             params.HTTPClient,
    84  	}
    85  	for _, opt := range opts {
    86  		opt(op)
    87  	}
    88  
    89  	result, err := a.transport.Submit(op)
    90  	if err != nil {
    91  		return nil, nil, err
    92  	}
    93  	switch value := result.(type) {
    94  	case *DeleteEndpointOK:
    95  		return value, nil, nil
    96  	case *DeleteEndpointErrors:
    97  		return nil, value, nil
    98  	}
    99  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   100  	msg := fmt.Sprintf("unexpected success response for endpoint: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   101  	panic(msg)
   102  }
   103  
   104  /*
   105  	DeleteEndpointID deletes endpoint
   106  
   107  	Deletes the endpoint specified by the ID. Deletion is imminent and
   108  
   109  atomic, if the deletion request is valid and the endpoint exists,
   110  deletion will occur even if errors are encountered in the process. If
   111  errors have been encountered, the code 202 will be returned, otherwise
   112  200 on success.
   113  
   114  All resources associated with the endpoint will be freed and the
   115  workload represented by the endpoint will be disconnected.It will no
   116  longer be able to initiate or receive communications of any sort.
   117  */
   118  func (a *Client) DeleteEndpointID(params *DeleteEndpointIDParams, opts ...ClientOption) (*DeleteEndpointIDOK, *DeleteEndpointIDErrors, error) {
   119  	// TODO: Validate the params before sending
   120  	if params == nil {
   121  		params = NewDeleteEndpointIDParams()
   122  	}
   123  	op := &runtime.ClientOperation{
   124  		ID:                 "DeleteEndpointID",
   125  		Method:             "DELETE",
   126  		PathPattern:        "/endpoint/{id}",
   127  		ProducesMediaTypes: []string{"application/json"},
   128  		ConsumesMediaTypes: []string{"application/json"},
   129  		Schemes:            []string{"http"},
   130  		Params:             params,
   131  		Reader:             &DeleteEndpointIDReader{formats: a.formats},
   132  		Context:            params.Context,
   133  		Client:             params.HTTPClient,
   134  	}
   135  	for _, opt := range opts {
   136  		opt(op)
   137  	}
   138  
   139  	result, err := a.transport.Submit(op)
   140  	if err != nil {
   141  		return nil, nil, err
   142  	}
   143  	switch value := result.(type) {
   144  	case *DeleteEndpointIDOK:
   145  		return value, nil, nil
   146  	case *DeleteEndpointIDErrors:
   147  		return nil, value, nil
   148  	}
   149  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   150  	msg := fmt.Sprintf("unexpected success response for endpoint: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   151  	panic(msg)
   152  }
   153  
   154  /*
   155  GetEndpoint retrieves a list of endpoints that have metadata matching the provided parameters
   156  
   157  Retrieves a list of endpoints that have metadata matching the provided parameters, or all endpoints if no parameters provided.
   158  */
   159  func (a *Client) GetEndpoint(params *GetEndpointParams, opts ...ClientOption) (*GetEndpointOK, error) {
   160  	// TODO: Validate the params before sending
   161  	if params == nil {
   162  		params = NewGetEndpointParams()
   163  	}
   164  	op := &runtime.ClientOperation{
   165  		ID:                 "GetEndpoint",
   166  		Method:             "GET",
   167  		PathPattern:        "/endpoint",
   168  		ProducesMediaTypes: []string{"application/json"},
   169  		ConsumesMediaTypes: []string{"application/json"},
   170  		Schemes:            []string{"http"},
   171  		Params:             params,
   172  		Reader:             &GetEndpointReader{formats: a.formats},
   173  		Context:            params.Context,
   174  		Client:             params.HTTPClient,
   175  	}
   176  	for _, opt := range opts {
   177  		opt(op)
   178  	}
   179  
   180  	result, err := a.transport.Submit(op)
   181  	if err != nil {
   182  		return nil, err
   183  	}
   184  	success, ok := result.(*GetEndpointOK)
   185  	if ok {
   186  		return success, nil
   187  	}
   188  	// unexpected success response
   189  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   190  	msg := fmt.Sprintf("unexpected success response for GetEndpoint: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   191  	panic(msg)
   192  }
   193  
   194  /*
   195  GetEndpointID gets endpoint by endpoint ID
   196  
   197  Returns endpoint information
   198  */
   199  func (a *Client) GetEndpointID(params *GetEndpointIDParams, opts ...ClientOption) (*GetEndpointIDOK, error) {
   200  	// TODO: Validate the params before sending
   201  	if params == nil {
   202  		params = NewGetEndpointIDParams()
   203  	}
   204  	op := &runtime.ClientOperation{
   205  		ID:                 "GetEndpointID",
   206  		Method:             "GET",
   207  		PathPattern:        "/endpoint/{id}",
   208  		ProducesMediaTypes: []string{"application/json"},
   209  		ConsumesMediaTypes: []string{"application/json"},
   210  		Schemes:            []string{"http"},
   211  		Params:             params,
   212  		Reader:             &GetEndpointIDReader{formats: a.formats},
   213  		Context:            params.Context,
   214  		Client:             params.HTTPClient,
   215  	}
   216  	for _, opt := range opts {
   217  		opt(op)
   218  	}
   219  
   220  	result, err := a.transport.Submit(op)
   221  	if err != nil {
   222  		return nil, err
   223  	}
   224  	success, ok := result.(*GetEndpointIDOK)
   225  	if ok {
   226  		return success, nil
   227  	}
   228  	// unexpected success response
   229  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   230  	msg := fmt.Sprintf("unexpected success response for GetEndpointID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   231  	panic(msg)
   232  }
   233  
   234  /*
   235  GetEndpointIDConfig retrieves endpoint configuration
   236  
   237  Retrieves the configuration of the specified endpoint.
   238  */
   239  func (a *Client) GetEndpointIDConfig(params *GetEndpointIDConfigParams, opts ...ClientOption) (*GetEndpointIDConfigOK, error) {
   240  	// TODO: Validate the params before sending
   241  	if params == nil {
   242  		params = NewGetEndpointIDConfigParams()
   243  	}
   244  	op := &runtime.ClientOperation{
   245  		ID:                 "GetEndpointIDConfig",
   246  		Method:             "GET",
   247  		PathPattern:        "/endpoint/{id}/config",
   248  		ProducesMediaTypes: []string{"application/json"},
   249  		ConsumesMediaTypes: []string{"application/json"},
   250  		Schemes:            []string{"http"},
   251  		Params:             params,
   252  		Reader:             &GetEndpointIDConfigReader{formats: a.formats},
   253  		Context:            params.Context,
   254  		Client:             params.HTTPClient,
   255  	}
   256  	for _, opt := range opts {
   257  		opt(op)
   258  	}
   259  
   260  	result, err := a.transport.Submit(op)
   261  	if err != nil {
   262  		return nil, err
   263  	}
   264  	success, ok := result.(*GetEndpointIDConfigOK)
   265  	if ok {
   266  		return success, nil
   267  	}
   268  	// unexpected success response
   269  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   270  	msg := fmt.Sprintf("unexpected success response for GetEndpointIDConfig: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   271  	panic(msg)
   272  }
   273  
   274  /*
   275  GetEndpointIDHealthz retrieves the status logs associated with this endpoint
   276  */
   277  func (a *Client) GetEndpointIDHealthz(params *GetEndpointIDHealthzParams, opts ...ClientOption) (*GetEndpointIDHealthzOK, error) {
   278  	// TODO: Validate the params before sending
   279  	if params == nil {
   280  		params = NewGetEndpointIDHealthzParams()
   281  	}
   282  	op := &runtime.ClientOperation{
   283  		ID:                 "GetEndpointIDHealthz",
   284  		Method:             "GET",
   285  		PathPattern:        "/endpoint/{id}/healthz",
   286  		ProducesMediaTypes: []string{"application/json"},
   287  		ConsumesMediaTypes: []string{"application/json"},
   288  		Schemes:            []string{"http"},
   289  		Params:             params,
   290  		Reader:             &GetEndpointIDHealthzReader{formats: a.formats},
   291  		Context:            params.Context,
   292  		Client:             params.HTTPClient,
   293  	}
   294  	for _, opt := range opts {
   295  		opt(op)
   296  	}
   297  
   298  	result, err := a.transport.Submit(op)
   299  	if err != nil {
   300  		return nil, err
   301  	}
   302  	success, ok := result.(*GetEndpointIDHealthzOK)
   303  	if ok {
   304  		return success, nil
   305  	}
   306  	// unexpected success response
   307  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   308  	msg := fmt.Sprintf("unexpected success response for GetEndpointIDHealthz: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   309  	panic(msg)
   310  }
   311  
   312  /*
   313  GetEndpointIDLabels retrieves the list of labels associated with an endpoint
   314  */
   315  func (a *Client) GetEndpointIDLabels(params *GetEndpointIDLabelsParams, opts ...ClientOption) (*GetEndpointIDLabelsOK, error) {
   316  	// TODO: Validate the params before sending
   317  	if params == nil {
   318  		params = NewGetEndpointIDLabelsParams()
   319  	}
   320  	op := &runtime.ClientOperation{
   321  		ID:                 "GetEndpointIDLabels",
   322  		Method:             "GET",
   323  		PathPattern:        "/endpoint/{id}/labels",
   324  		ProducesMediaTypes: []string{"application/json"},
   325  		ConsumesMediaTypes: []string{"application/json"},
   326  		Schemes:            []string{"http"},
   327  		Params:             params,
   328  		Reader:             &GetEndpointIDLabelsReader{formats: a.formats},
   329  		Context:            params.Context,
   330  		Client:             params.HTTPClient,
   331  	}
   332  	for _, opt := range opts {
   333  		opt(op)
   334  	}
   335  
   336  	result, err := a.transport.Submit(op)
   337  	if err != nil {
   338  		return nil, err
   339  	}
   340  	success, ok := result.(*GetEndpointIDLabelsOK)
   341  	if ok {
   342  		return success, nil
   343  	}
   344  	// unexpected success response
   345  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   346  	msg := fmt.Sprintf("unexpected success response for GetEndpointIDLabels: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   347  	panic(msg)
   348  }
   349  
   350  /*
   351  GetEndpointIDLog retrieves the status logs associated with this endpoint
   352  */
   353  func (a *Client) GetEndpointIDLog(params *GetEndpointIDLogParams, opts ...ClientOption) (*GetEndpointIDLogOK, error) {
   354  	// TODO: Validate the params before sending
   355  	if params == nil {
   356  		params = NewGetEndpointIDLogParams()
   357  	}
   358  	op := &runtime.ClientOperation{
   359  		ID:                 "GetEndpointIDLog",
   360  		Method:             "GET",
   361  		PathPattern:        "/endpoint/{id}/log",
   362  		ProducesMediaTypes: []string{"application/json"},
   363  		ConsumesMediaTypes: []string{"application/json"},
   364  		Schemes:            []string{"http"},
   365  		Params:             params,
   366  		Reader:             &GetEndpointIDLogReader{formats: a.formats},
   367  		Context:            params.Context,
   368  		Client:             params.HTTPClient,
   369  	}
   370  	for _, opt := range opts {
   371  		opt(op)
   372  	}
   373  
   374  	result, err := a.transport.Submit(op)
   375  	if err != nil {
   376  		return nil, err
   377  	}
   378  	success, ok := result.(*GetEndpointIDLogOK)
   379  	if ok {
   380  		return success, nil
   381  	}
   382  	// unexpected success response
   383  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   384  	msg := fmt.Sprintf("unexpected success response for GetEndpointIDLog: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   385  	panic(msg)
   386  }
   387  
   388  /*
   389  PatchEndpointID modifies existing endpoint
   390  
   391  Applies the endpoint change request to an existing endpoint
   392  */
   393  func (a *Client) PatchEndpointID(params *PatchEndpointIDParams, opts ...ClientOption) (*PatchEndpointIDOK, error) {
   394  	// TODO: Validate the params before sending
   395  	if params == nil {
   396  		params = NewPatchEndpointIDParams()
   397  	}
   398  	op := &runtime.ClientOperation{
   399  		ID:                 "PatchEndpointID",
   400  		Method:             "PATCH",
   401  		PathPattern:        "/endpoint/{id}",
   402  		ProducesMediaTypes: []string{"application/json"},
   403  		ConsumesMediaTypes: []string{"application/json"},
   404  		Schemes:            []string{"http"},
   405  		Params:             params,
   406  		Reader:             &PatchEndpointIDReader{formats: a.formats},
   407  		Context:            params.Context,
   408  		Client:             params.HTTPClient,
   409  	}
   410  	for _, opt := range opts {
   411  		opt(op)
   412  	}
   413  
   414  	result, err := a.transport.Submit(op)
   415  	if err != nil {
   416  		return nil, err
   417  	}
   418  	success, ok := result.(*PatchEndpointIDOK)
   419  	if ok {
   420  		return success, nil
   421  	}
   422  	// unexpected success response
   423  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   424  	msg := fmt.Sprintf("unexpected success response for PatchEndpointID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   425  	panic(msg)
   426  }
   427  
   428  /*
   429  	PatchEndpointIDConfig modifies mutable endpoint configuration
   430  
   431  	Update the configuration of an existing endpoint and regenerates &
   432  
   433  recompiles the corresponding programs automatically.
   434  */
   435  func (a *Client) PatchEndpointIDConfig(params *PatchEndpointIDConfigParams, opts ...ClientOption) (*PatchEndpointIDConfigOK, error) {
   436  	// TODO: Validate the params before sending
   437  	if params == nil {
   438  		params = NewPatchEndpointIDConfigParams()
   439  	}
   440  	op := &runtime.ClientOperation{
   441  		ID:                 "PatchEndpointIDConfig",
   442  		Method:             "PATCH",
   443  		PathPattern:        "/endpoint/{id}/config",
   444  		ProducesMediaTypes: []string{"application/json"},
   445  		ConsumesMediaTypes: []string{"application/json"},
   446  		Schemes:            []string{"http"},
   447  		Params:             params,
   448  		Reader:             &PatchEndpointIDConfigReader{formats: a.formats},
   449  		Context:            params.Context,
   450  		Client:             params.HTTPClient,
   451  	}
   452  	for _, opt := range opts {
   453  		opt(op)
   454  	}
   455  
   456  	result, err := a.transport.Submit(op)
   457  	if err != nil {
   458  		return nil, err
   459  	}
   460  	success, ok := result.(*PatchEndpointIDConfigOK)
   461  	if ok {
   462  		return success, nil
   463  	}
   464  	// unexpected success response
   465  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   466  	msg := fmt.Sprintf("unexpected success response for PatchEndpointIDConfig: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   467  	panic(msg)
   468  }
   469  
   470  /*
   471  	PatchEndpointIDLabels sets label configuration of endpoint
   472  
   473  	Sets labels associated with an endpoint. These can be user provided or
   474  
   475  derived from the orchestration system.
   476  */
   477  func (a *Client) PatchEndpointIDLabels(params *PatchEndpointIDLabelsParams, opts ...ClientOption) (*PatchEndpointIDLabelsOK, error) {
   478  	// TODO: Validate the params before sending
   479  	if params == nil {
   480  		params = NewPatchEndpointIDLabelsParams()
   481  	}
   482  	op := &runtime.ClientOperation{
   483  		ID:                 "PatchEndpointIDLabels",
   484  		Method:             "PATCH",
   485  		PathPattern:        "/endpoint/{id}/labels",
   486  		ProducesMediaTypes: []string{"application/json"},
   487  		ConsumesMediaTypes: []string{"application/json"},
   488  		Schemes:            []string{"http"},
   489  		Params:             params,
   490  		Reader:             &PatchEndpointIDLabelsReader{formats: a.formats},
   491  		Context:            params.Context,
   492  		Client:             params.HTTPClient,
   493  	}
   494  	for _, opt := range opts {
   495  		opt(op)
   496  	}
   497  
   498  	result, err := a.transport.Submit(op)
   499  	if err != nil {
   500  		return nil, err
   501  	}
   502  	success, ok := result.(*PatchEndpointIDLabelsOK)
   503  	if ok {
   504  		return success, nil
   505  	}
   506  	// unexpected success response
   507  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   508  	msg := fmt.Sprintf("unexpected success response for PatchEndpointIDLabels: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   509  	panic(msg)
   510  }
   511  
   512  /*
   513  PutEndpointID creates endpoint
   514  
   515  Creates a new endpoint
   516  */
   517  func (a *Client) PutEndpointID(params *PutEndpointIDParams, opts ...ClientOption) (*PutEndpointIDCreated, error) {
   518  	// TODO: Validate the params before sending
   519  	if params == nil {
   520  		params = NewPutEndpointIDParams()
   521  	}
   522  	op := &runtime.ClientOperation{
   523  		ID:                 "PutEndpointID",
   524  		Method:             "PUT",
   525  		PathPattern:        "/endpoint/{id}",
   526  		ProducesMediaTypes: []string{"application/json"},
   527  		ConsumesMediaTypes: []string{"application/json"},
   528  		Schemes:            []string{"http"},
   529  		Params:             params,
   530  		Reader:             &PutEndpointIDReader{formats: a.formats},
   531  		Context:            params.Context,
   532  		Client:             params.HTTPClient,
   533  	}
   534  	for _, opt := range opts {
   535  		opt(op)
   536  	}
   537  
   538  	result, err := a.transport.Submit(op)
   539  	if err != nil {
   540  		return nil, err
   541  	}
   542  	success, ok := result.(*PutEndpointIDCreated)
   543  	if ok {
   544  		return success, nil
   545  	}
   546  	// unexpected success response
   547  	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
   548  	msg := fmt.Sprintf("unexpected success response for PutEndpointID: API contract not enforced by server. Client expected to get an error, but got: %T", result)
   549  	panic(msg)
   550  }
   551  
   552  // SetTransport changes the transport on the client
   553  func (a *Client) SetTransport(transport runtime.ClientTransport) {
   554  	a.transport = transport
   555  }