restapi

package
v0.0.0-...-87359d1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package restapi provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT.

Package restapi provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT.

Package restapi provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

func NewTriggerBuildRequest

func NewTriggerBuildRequest(server string, namespace string, name string, params *TriggerBuildParams) (*http.Request, error)

NewTriggerBuildRequest generates requests for TriggerBuild

Types

type ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) TriggerBuild

func (c *Client) TriggerBuild(ctx context.Context, namespace string, name string, params *TriggerBuildParams, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// TriggerBuild request
	TriggerBuild(ctx context.Context, namespace string, name string, params *TriggerBuildParams, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) TriggerBuildWithResponse

func (c *ClientWithResponses) TriggerBuildWithResponse(ctx context.Context, namespace string, name string, params *TriggerBuildParams, reqEditors ...RequestEditorFn) (*TriggerBuildResponse, error)

TriggerBuildWithResponse request returning *TriggerBuildResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// TriggerBuild request
	TriggerBuildWithResponse(ctx context.Context, namespace string, name string, params *TriggerBuildParams, reqEditors ...RequestEditorFn) (*TriggerBuildResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type MessageResponse

type MessageResponse struct {
	// Content
	Content   *interface{} `json:"content,omitempty"`
	Directive *string      `json:"directive,omitempty"`
	MessageId *string      `json:"message_id,omitempty"`
}

MessageResponse defines model for message-response.

type MiddlewareFunc

type MiddlewareFunc func(http.HandlerFunc) http.HandlerFunc

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ServerInterface

type ServerInterface interface {

	// (POST /api/osbuild/v1/namespaces/{namespace}/osbuildconfig/{name}/webhooks)
	TriggerBuild(w http.ResponseWriter, r *http.Request, namespace string, name string, params TriggerBuildParams)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) TriggerBuild

func (siw *ServerInterfaceWrapper) TriggerBuild(w http.ResponseWriter, r *http.Request)

TriggerBuild operation middleware

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type TriggerBuildParams

type TriggerBuildParams struct {
	// The secret value of the secret with a key named WebHookSecretKey that the webhook definition reference to. The secret ensures the uniqueness of the URL, preventing others from triggering the build
	Secret string `json:"secret"`
}

TriggerBuildParams defines parameters for TriggerBuild.

type TriggerBuildResponse

type TriggerBuildResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *MessageResponse
}

func ParseTriggerBuildResponse

func ParseTriggerBuildResponse(rsp *http.Response) (*TriggerBuildResponse, error)

ParseTriggerBuildResponse parses an HTTP response from a TriggerBuildWithResponse call

func (TriggerBuildResponse) Status

func (r TriggerBuildResponse) Status() string

Status returns HTTPResponse.Status

func (TriggerBuildResponse) StatusCode

func (r TriggerBuildResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL