github.com/kubearmor/cilium@v1.6.12/api/v1/client/service/service_client.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package service 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 "github.com/go-openapi/runtime" 10 11 strfmt "github.com/go-openapi/strfmt" 12 ) 13 14 // New creates a new service API client. 15 func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { 16 return &Client{transport: transport, formats: formats} 17 } 18 19 /* 20 Client for service API 21 */ 22 type Client struct { 23 transport runtime.ClientTransport 24 formats strfmt.Registry 25 } 26 27 /* 28 DeleteServiceID deletes a service 29 */ 30 func (a *Client) DeleteServiceID(params *DeleteServiceIDParams) (*DeleteServiceIDOK, error) { 31 // TODO: Validate the params before sending 32 if params == nil { 33 params = NewDeleteServiceIDParams() 34 } 35 36 result, err := a.transport.Submit(&runtime.ClientOperation{ 37 ID: "DeleteServiceID", 38 Method: "DELETE", 39 PathPattern: "/service/{id}", 40 ProducesMediaTypes: []string{"application/json"}, 41 ConsumesMediaTypes: []string{"application/json"}, 42 Schemes: []string{"http"}, 43 Params: params, 44 Reader: &DeleteServiceIDReader{formats: a.formats}, 45 Context: params.Context, 46 Client: params.HTTPClient, 47 }) 48 if err != nil { 49 return nil, err 50 } 51 return result.(*DeleteServiceIDOK), nil 52 53 } 54 55 /* 56 GetService retrieves list of all services 57 */ 58 func (a *Client) GetService(params *GetServiceParams) (*GetServiceOK, error) { 59 // TODO: Validate the params before sending 60 if params == nil { 61 params = NewGetServiceParams() 62 } 63 64 result, err := a.transport.Submit(&runtime.ClientOperation{ 65 ID: "GetService", 66 Method: "GET", 67 PathPattern: "/service", 68 ProducesMediaTypes: []string{"application/json"}, 69 ConsumesMediaTypes: []string{"application/json"}, 70 Schemes: []string{"http"}, 71 Params: params, 72 Reader: &GetServiceReader{formats: a.formats}, 73 Context: params.Context, 74 Client: params.HTTPClient, 75 }) 76 if err != nil { 77 return nil, err 78 } 79 return result.(*GetServiceOK), nil 80 81 } 82 83 /* 84 GetServiceID retrieves configuration of a service 85 */ 86 func (a *Client) GetServiceID(params *GetServiceIDParams) (*GetServiceIDOK, error) { 87 // TODO: Validate the params before sending 88 if params == nil { 89 params = NewGetServiceIDParams() 90 } 91 92 result, err := a.transport.Submit(&runtime.ClientOperation{ 93 ID: "GetServiceID", 94 Method: "GET", 95 PathPattern: "/service/{id}", 96 ProducesMediaTypes: []string{"application/json"}, 97 ConsumesMediaTypes: []string{"application/json"}, 98 Schemes: []string{"http"}, 99 Params: params, 100 Reader: &GetServiceIDReader{formats: a.formats}, 101 Context: params.Context, 102 Client: params.HTTPClient, 103 }) 104 if err != nil { 105 return nil, err 106 } 107 return result.(*GetServiceIDOK), nil 108 109 } 110 111 /* 112 PutServiceID creates or update service 113 */ 114 func (a *Client) PutServiceID(params *PutServiceIDParams) (*PutServiceIDOK, *PutServiceIDCreated, error) { 115 // TODO: Validate the params before sending 116 if params == nil { 117 params = NewPutServiceIDParams() 118 } 119 120 result, err := a.transport.Submit(&runtime.ClientOperation{ 121 ID: "PutServiceID", 122 Method: "PUT", 123 PathPattern: "/service/{id}", 124 ProducesMediaTypes: []string{"application/json"}, 125 ConsumesMediaTypes: []string{"application/json"}, 126 Schemes: []string{"http"}, 127 Params: params, 128 Reader: &PutServiceIDReader{formats: a.formats}, 129 Context: params.Context, 130 Client: params.HTTPClient, 131 }) 132 if err != nil { 133 return nil, nil, err 134 } 135 switch value := result.(type) { 136 case *PutServiceIDOK: 137 return value, nil, nil 138 case *PutServiceIDCreated: 139 return nil, value, nil 140 } 141 return nil, nil, nil 142 143 } 144 145 // SetTransport changes the transport on the client 146 func (a *Client) SetTransport(transport runtime.ClientTransport) { 147 a.transport = transport 148 }