v1

package
v0.0.0-...-89b14fa Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

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

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.6.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler

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

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler

func HandlerWithOptions

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

HandlerWithOptions creates http.Handler with additional options

func NewCmdAddRequest

func NewCmdAddRequest(server string, body CmdAddJSONRequestBody) (*http.Request, error)

NewCmdAddRequest calls the generic CmdAdd builder with application/json body

func NewCmdAddRequestWithBody

func NewCmdAddRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewCmdAddRequestWithBody generates requests for CmdAdd with any type of body

func NewHealthRequest

func NewHealthRequest(server string) (*http.Request, error)

NewHealthRequest generates requests for Health

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

Types

type AddArgs

type AddArgs struct {
	ContainerID  string `json:"containerID"`
	Ipv4         bool   `json:"ipv4"`
	Ipv6         bool   `json:"ipv6"`
	PodName      string `json:"podName"`
	PodNamespace string `json:"podNamespace"`
	PodUID       string `json:"podUID"`
}

AddArgs defines model for AddArgs.

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) CmdAdd

func (c *Client) CmdAdd(ctx context.Context, body CmdAddJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) CmdAddWithBody

func (c *Client) CmdAddWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) Health

func (c *Client) Health(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// Health request
	Health(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// CmdAddWithBody request with any body
	CmdAddWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	CmdAdd(ctx context.Context, body CmdAddJSONRequestBody, 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) CmdAddWithBodyWithResponse

func (c *ClientWithResponses) CmdAddWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CmdAddResponse, error)

CmdAddWithBodyWithResponse request with arbitrary body returning *CmdAddResponse

func (*ClientWithResponses) CmdAddWithResponse

func (c *ClientWithResponses) CmdAddWithResponse(ctx context.Context, body CmdAddJSONRequestBody, reqEditors ...RequestEditorFn) (*CmdAddResponse, error)

func (*ClientWithResponses) HealthWithResponse

func (c *ClientWithResponses) HealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthResponse, error)

HealthWithResponse request returning *HealthResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// HealthWithResponse request
	HealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthResponse, error)

	// CmdAddWithBodyWithResponse request with any body
	CmdAddWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CmdAddResponse, error)

	CmdAddWithResponse(ctx context.Context, body CmdAddJSONRequestBody, reqEditors ...RequestEditorFn) (*CmdAddResponse, error)
}

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

type CmdAdd200JSONResponse

type CmdAdd200JSONResponse Result

func (CmdAdd200JSONResponse) VisitCmdAddResponse

func (response CmdAdd200JSONResponse) VisitCmdAddResponse(w http.ResponseWriter) error

type CmdAddJSONRequestBody

type CmdAddJSONRequestBody = AddArgs

CmdAddJSONRequestBody defines body for CmdAdd for application/json ContentType.

type CmdAddRequestObject

type CmdAddRequestObject struct {
	Body *CmdAddJSONRequestBody
}

type CmdAddResponse

type CmdAddResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Result
	JSONDefault  *Error
}

func ParseCmdAddResponse

func ParseCmdAddResponse(rsp *http.Response) (*CmdAddResponse, error)

ParseCmdAddResponse parses an HTTP response from a CmdAddWithResponse call

func (CmdAddResponse) Status

func (r CmdAddResponse) Status() string

Status returns HTTPResponse.Status

func (CmdAddResponse) StatusCode

func (r CmdAddResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type CmdAddResponseObject

type CmdAddResponseObject interface {
	VisitCmdAddResponse(w http.ResponseWriter) error
}

type CmdAdddefaultJSONResponse

type CmdAdddefaultJSONResponse struct {
	Body       Error
	StatusCode int
}

func (CmdAdddefaultJSONResponse) VisitCmdAddResponse

func (response CmdAdddefaultJSONResponse) VisitCmdAddResponse(w http.ResponseWriter) error

type DNS

type DNS struct {
	Domain      *string   `json:"domain,omitempty"`
	Nameservers []string  `json:"nameservers"`
	Options     *[]string `json:"options,omitempty"`
	Search      *[]string `json:"search,omitempty"`
}

DNS defines model for DNS.

type Error

type Error = string

Error defines model for Error.

type Health200Response

type Health200Response struct {
}

func (Health200Response) VisitHealthResponse

func (response Health200Response) VisitHealthResponse(w http.ResponseWriter) error

type HealthRequestObject

type HealthRequestObject struct {
}

type HealthResponse

type HealthResponse struct {
	Body         []byte
	HTTPResponse *http.Response
}

func ParseHealthResponse

func ParseHealthResponse(rsp *http.Response) (*HealthResponse, error)

ParseHealthResponse parses an HTTP response from a HealthWithResponse call

func (HealthResponse) Status

func (r HealthResponse) Status() string

Status returns HTTPResponse.Status

func (HealthResponse) StatusCode

func (r HealthResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HealthResponseObject

type HealthResponseObject interface {
	VisitHealthResponse(w http.ResponseWriter) error
}

type HttpRequestDoer

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

Doer performs HTTP requests.

The standard http.Client implements this interface.

type IPConfig

type IPConfig struct {
	Address string  `json:"address"`
	Gateway *string `json:"gateway,omitempty"`
}

IPConfig defines model for IPConfig.

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 MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

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 Result

type Result struct {
	Dns    *DNS       `json:"dns,omitempty"`
	Ips    []IPConfig `json:"ips"`
	Routes *[]Route   `json:"routes,omitempty"`
}

Result defines model for Result.

type Route

type Route struct {
	Dst string  `json:"dst"`
	Gw  *string `json:"gw,omitempty"`
}

Route defines model for Route.

type ServeMux

type ServeMux interface {
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
	ServeHTTP(w http.ResponseWriter, r *http.Request)
}

ServeMux is an abstraction of http.ServeMux.

type ServerInterface

type ServerInterface interface {

	// (GET /health)
	Health(w http.ResponseWriter, r *http.Request)

	// (POST /ips)
	CmdAdd(w http.ResponseWriter, r *http.Request)
}

ServerInterface represents all server handlers.

func NewStrictHandler

func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface

func NewStrictHandlerWithOptions

func NewStrictHandlerWithOptions(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc, options StrictHTTPServerOptions) ServerInterface

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) CmdAdd

CmdAdd operation middleware

func (*ServerInterfaceWrapper) Health

Health operation middleware

type StdHTTPServerOptions

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

type StrictHTTPServerOptions

type StrictHTTPServerOptions struct {
	RequestErrorHandlerFunc  func(w http.ResponseWriter, r *http.Request, err error)
	ResponseErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type StrictServerInterface

type StrictServerInterface interface {

	// (GET /health)
	Health(ctx context.Context, request HealthRequestObject) (HealthResponseObject, error)

	// (POST /ips)
	CmdAdd(ctx context.Context, request CmdAddRequestObject) (CmdAddResponseObject, error)
}

StrictServerInterface represents all server handlers.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

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