Documentation ¶
Index ¶
- func ExecuteTemplate(responseText []byte, resp *http.Response, input any, ...) ([]byte, error)
- func HasJSONHeader(h *http.Header) bool
- func RequestSupportsBody(method string) bool
- type RequestDetails
- type RequestHandler
- func (r *RequestHandler) DryRunHandler(iostream *iostreams.IOStreams, options *c8y.RequestOptions, req *http.Request)
- func (r *RequestHandler) DumpRequest(w io.Writer, req *http.Request)
- func (r *RequestHandler) GetCurlCommands(req *http.Request) (shell string, pwsh string, err error)
- func (r *RequestHandler) GetTimeoutContext() (context.Context, context.CancelFunc)
- func (r *RequestHandler) PrintRequestDetails(w io.Writer, requestOptions *c8y.RequestOptions, req *http.Request)
- func (r *RequestHandler) ProcessRequestAndResponse(requests []c8y.RequestOptions, input any, ...) (*c8y.Response, error)
- func (r *RequestHandler) ProcessResponse(resp *c8y.Response, respError error, input any, ...) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteTemplate ¶ added in v2.32.0
func HasJSONHeader ¶
HasJSONHeader returns true if the header contains a json content type
func RequestSupportsBody ¶
Check if method supports a body with the request
Types ¶
type RequestDetails ¶
type RequestDetails struct { URL string `json:"url,omitempty"` Host string `json:"host,omitempty"` PathEncoded string `json:"pathEncoded,omitempty"` Path string `json:"path,omitempty"` Query string `json:"query,omitempty"` Method string `json:"method,omitempty"` Headers map[string]string `json:"headers,omitempty"` Body interface{} `json:"body,omitempty"` Shell string `json:"shell,omitempty"` PowerShell string `json:"powershell,omitempty"` }
type RequestHandler ¶
type RequestHandler struct { Console *console.Console IsTerminal bool IO *iostreams.IOStreams Client *c8y.Client Config *config.Config Logger *logger.Logger DataView *dataview.DataView ActivityLogger *activitylogger.ActivityLogger HideSensitive func(*c8y.Client, string) string }
func (*RequestHandler) DryRunHandler ¶
func (r *RequestHandler) DryRunHandler(iostream *iostreams.IOStreams, options *c8y.RequestOptions, req *http.Request)
func (*RequestHandler) DumpRequest ¶
func (r *RequestHandler) DumpRequest(w io.Writer, req *http.Request)
func (*RequestHandler) GetCurlCommands ¶
func (*RequestHandler) GetTimeoutContext ¶
func (r *RequestHandler) GetTimeoutContext() (context.Context, context.CancelFunc)
func (*RequestHandler) PrintRequestDetails ¶
func (r *RequestHandler) PrintRequestDetails(w io.Writer, requestOptions *c8y.RequestOptions, req *http.Request)
PrintRequestDetails prints the request to the console making it easier to extra informatino from it
func (*RequestHandler) ProcessRequestAndResponse ¶
func (r *RequestHandler) ProcessRequestAndResponse(requests []c8y.RequestOptions, input any, commonOptions config.CommonCommandOptions) (*c8y.Response, error)
func (*RequestHandler) ProcessResponse ¶
func (r *RequestHandler) ProcessResponse(resp *c8y.Response, respError error, input any, commonOptions config.CommonCommandOptions) (int, error)
Click to show internal directories.
Click to hide internal directories.