Documentation ¶
Overview ¶
Package testvault provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.10.1 DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- 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 NewAddMemberToVaultRequest(server string, vaultId string, body AddMemberToVaultJSONRequestBody) (*http.Request, error)
- func NewAddMemberToVaultRequestWithBody(server string, vaultId string, contentType string, body io.Reader) (*http.Request, error)
- func NewCheckVaultMembershipRequest(server string, vaultId string, memberId string) (*http.Request, error)
- func NewRemoveMemberFromVaultRequest(server string, vaultId string, memberId string) (*http.Request, error)
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- type API
- func (a *API) AddMemberToVault(w http.ResponseWriter, r *http.Request, vaultId string)
- func (a *API) CheckVaultMembership(w http.ResponseWriter, r *http.Request, vaultId string, memberId string)
- func (a *API) RemoveMemberFromVault(w http.ResponseWriter, r *http.Request, vaultId string, memberId string)
- func (a *API) Server() http.Handler
- type APIOpts
- type AddMember
- type AddMemberToVaultJSONRequestBody
- type AddMemberToVaultResponse
- type CheckVaultMembershipResponse
- type ChiServerOptions
- type Client
- func (c *Client) AddMemberToVault(ctx context.Context, vaultId string, body AddMemberToVaultJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) AddMemberToVaultWithBody(ctx context.Context, vaultId string, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) CheckVaultMembership(ctx context.Context, vaultId string, memberId string, ...) (*http.Response, error)
- func (c *Client) RemoveMemberFromVault(ctx context.Context, vaultId string, memberId string, ...) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) AddMemberToVaultWithBodyWithResponse(ctx context.Context, vaultId string, contentType string, body io.Reader, ...) (*AddMemberToVaultResponse, error)
- func (c *ClientWithResponses) AddMemberToVaultWithResponse(ctx context.Context, vaultId string, body AddMemberToVaultJSONRequestBody, ...) (*AddMemberToVaultResponse, error)
- func (c *ClientWithResponses) CheckVaultMembershipWithResponse(ctx context.Context, vaultId string, memberId string, ...) (*CheckVaultMembershipResponse, error)
- func (c *ClientWithResponses) RemoveMemberFromVaultWithResponse(ctx context.Context, vaultId string, memberId string, ...) (*RemoveMemberFromVaultResponse, error)
- type ClientWithResponsesInterface
- type ErrorResponse
- type GetMembership
- type HttpRequestDoer
- type InvalidParamFormatError
- type Membership
- type MembershipResponse
- type MiddlewareFunc
- type RemoveMemberFromVaultResponse
- type RequestEditorFn
- type RequiredHeaderError
- type RequiredParamError
- type ServerInterface
- type ServerInterfaceWrapper
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type UnmarshalingParamError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
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, 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 NewAddMemberToVaultRequest ¶
func NewAddMemberToVaultRequest(server string, vaultId string, body AddMemberToVaultJSONRequestBody) (*http.Request, error)
NewAddMemberToVaultRequest calls the generic AddMemberToVault builder with application/json body
func NewAddMemberToVaultRequestWithBody ¶
func NewAddMemberToVaultRequestWithBody(server string, vaultId string, contentType string, body io.Reader) (*http.Request, error)
NewAddMemberToVaultRequestWithBody generates requests for AddMemberToVault with any type of body
func NewCheckVaultMembershipRequest ¶
func NewCheckVaultMembershipRequest(server string, vaultId string, memberId string) (*http.Request, error)
NewCheckVaultMembershipRequest generates requests for CheckVaultMembership
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API holds the HTTP routes for the testvault service.
func (*API) AddMemberToVault ¶
Add member to vault (POST /vaults/{vaultId}/members)
func (*API) CheckVaultMembership ¶
func (a *API) CheckVaultMembership(w http.ResponseWriter, r *http.Request, vaultId string, memberId string)
Check vault membership (GET /vaults/{vaultId}/members/{memberId})
func (*API) RemoveMemberFromVault ¶
func (a *API) RemoveMemberFromVault(w http.ResponseWriter, r *http.Request, vaultId string, memberId string)
Remove a member from a vault (POST /vaults/{vaultId}/members/{memberId}/remove)
type AddMember ¶
type AddMember struct { // The user ID or email to add to the vault. This can be any string. User string `json:"user"` }
AddMember defines model for AddMember.
type AddMemberToVaultJSONRequestBody ¶
type AddMemberToVaultJSONRequestBody AddMember
AddMemberToVaultJSONRequestBody defines body for AddMemberToVault for application/json ContentType.
type AddMemberToVaultResponse ¶
func ParseAddMemberToVaultResponse ¶
func ParseAddMemberToVaultResponse(rsp *http.Response) (*AddMemberToVaultResponse, error)
ParseAddMemberToVaultResponse parses an HTTP response from a AddMemberToVaultWithResponse call
func (AddMemberToVaultResponse) Status ¶
func (r AddMemberToVaultResponse) Status() string
Status returns HTTPResponse.Status
func (AddMemberToVaultResponse) StatusCode ¶
func (r AddMemberToVaultResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type CheckVaultMembershipResponse ¶
type CheckVaultMembershipResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { // A diagnostic message about the vault membership. Message string `json:"message"` } JSON404 *struct { Error string `json:"error"` } }
func ParseCheckVaultMembershipResponse ¶
func ParseCheckVaultMembershipResponse(rsp *http.Response) (*CheckVaultMembershipResponse, error)
ParseCheckVaultMembershipResponse parses an HTTP response from a CheckVaultMembershipWithResponse call
func (CheckVaultMembershipResponse) Status ¶
func (r CheckVaultMembershipResponse) Status() string
Status returns HTTPResponse.Status
func (CheckVaultMembershipResponse) StatusCode ¶
func (r CheckVaultMembershipResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
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) AddMemberToVault ¶
func (c *Client) AddMemberToVault(ctx context.Context, vaultId string, body AddMemberToVaultJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) AddMemberToVaultWithBody ¶
func (*Client) CheckVaultMembership ¶
type ClientInterface ¶
type ClientInterface interface { // AddMemberToVault request with any body AddMemberToVaultWithBody(ctx context.Context, vaultId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) AddMemberToVault(ctx context.Context, vaultId string, body AddMemberToVaultJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // CheckVaultMembership request CheckVaultMembership(ctx context.Context, vaultId string, memberId string, reqEditors ...RequestEditorFn) (*http.Response, error) // RemoveMemberFromVault request RemoveMemberFromVault(ctx context.Context, vaultId string, memberId string, 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) AddMemberToVaultWithBodyWithResponse ¶
func (c *ClientWithResponses) AddMemberToVaultWithBodyWithResponse(ctx context.Context, vaultId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddMemberToVaultResponse, error)
AddMemberToVaultWithBodyWithResponse request with arbitrary body returning *AddMemberToVaultResponse
func (*ClientWithResponses) AddMemberToVaultWithResponse ¶
func (c *ClientWithResponses) AddMemberToVaultWithResponse(ctx context.Context, vaultId string, body AddMemberToVaultJSONRequestBody, reqEditors ...RequestEditorFn) (*AddMemberToVaultResponse, error)
func (*ClientWithResponses) CheckVaultMembershipWithResponse ¶
func (c *ClientWithResponses) CheckVaultMembershipWithResponse(ctx context.Context, vaultId string, memberId string, reqEditors ...RequestEditorFn) (*CheckVaultMembershipResponse, error)
CheckVaultMembershipWithResponse request returning *CheckVaultMembershipResponse
func (*ClientWithResponses) RemoveMemberFromVaultWithResponse ¶
func (c *ClientWithResponses) RemoveMemberFromVaultWithResponse(ctx context.Context, vaultId string, memberId string, reqEditors ...RequestEditorFn) (*RemoveMemberFromVaultResponse, error)
RemoveMemberFromVaultWithResponse request returning *RemoveMemberFromVaultResponse
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface { // AddMemberToVault request with any body AddMemberToVaultWithBodyWithResponse(ctx context.Context, vaultId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddMemberToVaultResponse, error) AddMemberToVaultWithResponse(ctx context.Context, vaultId string, body AddMemberToVaultJSONRequestBody, reqEditors ...RequestEditorFn) (*AddMemberToVaultResponse, error) // CheckVaultMembership request CheckVaultMembershipWithResponse(ctx context.Context, vaultId string, memberId string, reqEditors ...RequestEditorFn) (*CheckVaultMembershipResponse, error) // RemoveMemberFromVault request RemoveMemberFromVaultWithResponse(ctx context.Context, vaultId string, memberId string, reqEditors ...RequestEditorFn) (*RemoveMemberFromVaultResponse, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
ErrorResponse defines model for ErrorResponse.
type GetMembership ¶
type GetMembership struct { Vault string User string Result *Membership }
GetMembership is the access pattern to fetch a vault membership from DynamoDB.
It returns ddb.ErrNoItems if the vault membership doesn't exist.
func (*GetMembership) BuildQuery ¶
func (g *GetMembership) BuildQuery() (*dynamodb.QueryInput, error)
func (*GetMembership) UnmarshalQueryOutput ¶
func (g *GetMembership) UnmarshalQueryOutput(out *dynamodb.QueryOutput) error
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 Membership ¶
type MembershipResponse ¶
type MembershipResponse struct { // A diagnostic message about the vault membership. Message string `json:"message"` }
MembershipResponse defines model for MembershipResponse.
type MiddlewareFunc ¶
type MiddlewareFunc func(http.HandlerFunc) http.HandlerFunc
type RemoveMemberFromVaultResponse ¶
type RemoveMemberFromVaultResponse struct { Body []byte HTTPResponse *http.Response JSON404 *struct { Error string `json:"error"` } }
func ParseRemoveMemberFromVaultResponse ¶
func ParseRemoveMemberFromVaultResponse(rsp *http.Response) (*RemoveMemberFromVaultResponse, error)
ParseRemoveMemberFromVaultResponse parses an HTTP response from a RemoveMemberFromVaultWithResponse call
func (RemoveMemberFromVaultResponse) Status ¶
func (r RemoveMemberFromVaultResponse) Status() string
Status returns HTTPResponse.Status
func (RemoveMemberFromVaultResponse) StatusCode ¶
func (r RemoveMemberFromVaultResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
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 ServerInterface ¶
type ServerInterface interface { // Add member to vault // (POST /vaults/{vaultId}/members) AddMemberToVault(w http.ResponseWriter, r *http.Request, vaultId string) // Check vault membership // (GET /vaults/{vaultId}/members/{memberId}) CheckVaultMembership(w http.ResponseWriter, r *http.Request, vaultId string, memberId string) // Remove a member from a vault // (POST /vaults/{vaultId}/members/{memberId}/remove) RemoveMemberFromVault(w http.ResponseWriter, r *http.Request, vaultId string, memberId string) }
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) AddMemberToVault ¶
func (siw *ServerInterfaceWrapper) AddMemberToVault(w http.ResponseWriter, r *http.Request)
AddMemberToVault operation middleware
func (*ServerInterfaceWrapper) CheckVaultMembership ¶
func (siw *ServerInterfaceWrapper) CheckVaultMembership(w http.ResponseWriter, r *http.Request)
CheckVaultMembership operation middleware
func (*ServerInterfaceWrapper) RemoveMemberFromVault ¶
func (siw *ServerInterfaceWrapper) RemoveMemberFromVault(w http.ResponseWriter, r *http.Request)
RemoveMemberFromVault 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 UnmarshalingParamError ¶
func (*UnmarshalingParamError) Error ¶
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶
func (e *UnmarshalingParamError) Unwrap() error