Documentation ¶
Overview ¶
Package api provides primitives to interact with the openapi HTTP API.
Code generated by unknown module path version unknown version DO NOT EDIT.
Package api provides primitives to interact with the openapi HTTP API.
Code generated by unknown module path version unknown version DO NOT EDIT.
Package api provides primitives to interact with the openapi HTTP API.
Code generated by unknown module path version unknown version DO NOT EDIT.
Index ¶
- func Error(w http.ResponseWriter, p Problem)
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
- func NewGetSegmentBlobRequest(server string, segmentId SegmentID) (*http.Request, error)
- func NewGetSegmentRequest(server string, segmentId SegmentID) (*http.Request, error)
- func NewGetSegmentsRequest(server string, params *GetSegmentsParams) (*http.Request, error)
- func SegID(s *seg.PathSegment) string
- type ChiServerOptions
- type Client
- func (c *Client) GetSegment(ctx context.Context, segmentId SegmentID, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetSegmentBlob(ctx context.Context, segmentId SegmentID, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetSegments(ctx context.Context, params *GetSegmentsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) GetSegmentBlobWithResponse(ctx context.Context, segmentId SegmentID, reqEditors ...RequestEditorFn) (*GetSegmentBlobResponse, error)
- func (c *ClientWithResponses) GetSegmentWithResponse(ctx context.Context, segmentId SegmentID, reqEditors ...RequestEditorFn) (*GetSegmentResponse, error)
- func (c *ClientWithResponses) GetSegmentsWithResponse(ctx context.Context, params *GetSegmentsParams, reqEditors ...RequestEditorFn) (*GetSegmentsResponse, error)
- type ClientWithResponsesInterface
- type GetSegmentBlobResponse
- type GetSegmentResponse
- type GetSegmentsParams
- type GetSegmentsResponse
- type Hop
- type HttpRequestDoer
- type InvalidParamFormatError
- type IsdAs
- type MiddlewareFunc
- type Problem
- type RequestEditorFn
- type RequiredHeaderError
- type RequiredParamError
- type Segment
- type SegmentBrief
- type SegmentID
- type SegmentStore
- type Server
- type ServerInterface
- type ServerInterfaceWrapper
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type UnmarshallingParamError
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 NewGetSegmentBlobRequest ¶
NewGetSegmentBlobRequest generates requests for GetSegmentBlob
func NewGetSegmentRequest ¶
NewGetSegmentRequest generates requests for GetSegment
func NewGetSegmentsRequest ¶
func NewGetSegmentsRequest(server string, params *GetSegmentsParams) (*http.Request, error)
NewGetSegmentsRequest generates requests for GetSegments
func SegID ¶
func SegID(s *seg.PathSegment) string
SegID makes a hex encoded string of the segment id.
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) GetSegment ¶
func (*Client) GetSegmentBlob ¶
func (*Client) GetSegments ¶
func (c *Client) GetSegments(ctx context.Context, params *GetSegmentsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
type ClientInterface ¶
type ClientInterface interface { // GetSegments request GetSegments(ctx context.Context, params *GetSegmentsParams, reqEditors ...RequestEditorFn) (*http.Response, error) // GetSegment request GetSegment(ctx context.Context, segmentId SegmentID, reqEditors ...RequestEditorFn) (*http.Response, error) // GetSegmentBlob request GetSegmentBlob(ctx context.Context, segmentId SegmentID, reqEditors ...RequestEditorFn) (*http.Response, error) }
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
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) GetSegmentBlobWithResponse ¶
func (c *ClientWithResponses) GetSegmentBlobWithResponse(ctx context.Context, segmentId SegmentID, reqEditors ...RequestEditorFn) (*GetSegmentBlobResponse, error)
GetSegmentBlobWithResponse request returning *GetSegmentBlobResponse
func (*ClientWithResponses) GetSegmentWithResponse ¶
func (c *ClientWithResponses) GetSegmentWithResponse(ctx context.Context, segmentId SegmentID, reqEditors ...RequestEditorFn) (*GetSegmentResponse, error)
GetSegmentWithResponse request returning *GetSegmentResponse
func (*ClientWithResponses) GetSegmentsWithResponse ¶
func (c *ClientWithResponses) GetSegmentsWithResponse(ctx context.Context, params *GetSegmentsParams, reqEditors ...RequestEditorFn) (*GetSegmentsResponse, error)
GetSegmentsWithResponse request returning *GetSegmentsResponse
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface { // GetSegments request GetSegmentsWithResponse(ctx context.Context, params *GetSegmentsParams, reqEditors ...RequestEditorFn) (*GetSegmentsResponse, error) // GetSegment request GetSegmentWithResponse(ctx context.Context, segmentId SegmentID, reqEditors ...RequestEditorFn) (*GetSegmentResponse, error) // GetSegmentBlob request GetSegmentBlobWithResponse(ctx context.Context, segmentId SegmentID, reqEditors ...RequestEditorFn) (*GetSegmentBlobResponse, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
type GetSegmentBlobResponse ¶
func ParseGetSegmentBlobResponse ¶
func ParseGetSegmentBlobResponse(rsp *http.Response) (*GetSegmentBlobResponse, error)
ParseGetSegmentBlobResponse parses an HTTP response from a GetSegmentBlobWithResponse call
func (GetSegmentBlobResponse) Status ¶
func (r GetSegmentBlobResponse) Status() string
Status returns HTTPResponse.Status
func (GetSegmentBlobResponse) StatusCode ¶
func (r GetSegmentBlobResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type GetSegmentResponse ¶
type GetSegmentResponse struct { Body []byte HTTPResponse *http.Response JSON200 *Segment JSON400 *Problem }
func ParseGetSegmentResponse ¶
func ParseGetSegmentResponse(rsp *http.Response) (*GetSegmentResponse, error)
ParseGetSegmentResponse parses an HTTP response from a GetSegmentWithResponse call
func (GetSegmentResponse) Status ¶
func (r GetSegmentResponse) Status() string
Status returns HTTPResponse.Status
func (GetSegmentResponse) StatusCode ¶
func (r GetSegmentResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type GetSegmentsParams ¶
type GetSegmentsParams struct { // StartIsdAs Start ISD-AS of segment. StartIsdAs *IsdAs `form:"start_isd_as,omitempty" json:"start_isd_as,omitempty"` // EndIsdAs Terminal AS of segment. EndIsdAs *IsdAs `form:"end_isd_as,omitempty" json:"end_isd_as,omitempty"` }
GetSegmentsParams defines parameters for GetSegments.
type GetSegmentsResponse ¶
type GetSegmentsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]SegmentBrief JSON400 *Problem }
func ParseGetSegmentsResponse ¶
func ParseGetSegmentsResponse(rsp *http.Response) (*GetSegmentsResponse, error)
ParseGetSegmentsResponse parses an HTTP response from a GetSegmentsWithResponse call
func (GetSegmentsResponse) Status ¶
func (r GetSegmentsResponse) Status() string
Status returns HTTPResponse.Status
func (GetSegmentsResponse) StatusCode ¶
func (r GetSegmentsResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type Problem ¶
type Problem struct { // Detail A human readable explanation specific to this occurrence of the problem that is helpful to locate the problem and give advice on how to proceed. Written in English and readable for engineers, usually not suited for non technical stakeholders and not localized. Detail *string `json:"detail,omitempty"` // Instance A URI reference that identifies the specific occurrence of the problem, e.g. by adding a fragment identifier or sub-path to the problem type. May be used to locate the root of this problem in the source code. Instance *string `json:"instance,omitempty"` // Status The HTTP status code generated by the origin server for this occurrence of the problem. Status int `json:"status"` // Title A short summary of the problem type. Written in English and readable for engineers, usually not suited for non technical stakeholders and not localized. Title string `json:"title"` // Type A URI reference that uniquely identifies the problem type only in the context of the provided API. Opposed to the specification in RFC-7807, it is neither recommended to be dereferencable and point to a human-readable documentation nor globally unique for the problem type. Type *string `json:"type,omitempty"` }
Problem defines model for Problem.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type RequiredHeaderError ¶
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 Segment ¶
type Segment struct { Expiration time.Time `json:"expiration"` Hops []Hop `json:"hops"` Id SegmentID `json:"id"` LastUpdated time.Time `json:"last_updated"` Timestamp time.Time `json:"timestamp"` }
Segment defines model for Segment.
type SegmentBrief ¶
type SegmentBrief struct { EndIsdAs IsdAs `json:"end_isd_as"` Id SegmentID `json:"id"` // Length Length of the segment. Length int `json:"length"` StartIsdAs IsdAs `json:"start_isd_as"` }
SegmentBrief defines model for SegmentBrief.
type SegmentStore ¶
type Server ¶
type Server struct {
Segments SegmentStore
}
func (*Server) GetSegment ¶
GetSegment gets a segments details specified by its ID.
func (*Server) GetSegmentBlob ¶
GetSegmentBlob gets a segment (specified by its ID) as a pem encoded blob.
func (*Server) GetSegments ¶
func (s *Server) GetSegments(w http.ResponseWriter, r *http.Request, params GetSegmentsParams)
GetSegments gets the stored in the PathDB.
type ServerInterface ¶
type ServerInterface interface { // List the SCION path segments // (GET /segments) GetSegments(w http.ResponseWriter, r *http.Request, params GetSegmentsParams) // Get the SCION path segment description // (GET /segments/{segment-id}) GetSegment(w http.ResponseWriter, r *http.Request, segmentId SegmentID) // Get the SCION path segment blob // (GET /segments/{segment-id}/blob) GetSegmentBlob(w http.ResponseWriter, r *http.Request, segmentId SegmentID) }
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) GetSegment ¶
func (siw *ServerInterfaceWrapper) GetSegment(w http.ResponseWriter, r *http.Request)
GetSegment operation middleware
func (*ServerInterfaceWrapper) GetSegmentBlob ¶
func (siw *ServerInterfaceWrapper) GetSegmentBlob(w http.ResponseWriter, r *http.Request)
GetSegmentBlob operation middleware
func (*ServerInterfaceWrapper) GetSegments ¶
func (siw *ServerInterfaceWrapper) GetSegments(w http.ResponseWriter, r *http.Request)
GetSegments operation middleware
type TooManyValuesForParamError ¶
func (*TooManyValuesForParamError) Error ¶
func (e *TooManyValuesForParamError) Error() string
type UnescapedCookieParamError ¶
func (*UnescapedCookieParamError) Error ¶
func (e *UnescapedCookieParamError) Error() string
func (*UnescapedCookieParamError) Unwrap ¶
func (e *UnescapedCookieParamError) Unwrap() error
type UnmarshallingParamError ¶ added in v0.9.0
func (*UnmarshallingParamError) Error ¶ added in v0.9.0
func (e *UnmarshallingParamError) Error() string
func (*UnmarshallingParamError) Unwrap ¶ added in v0.9.0
func (e *UnmarshallingParamError) Unwrap() error