Documentation
¶
Overview ¶
Package audit provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT.
Index ¶
- Constants
- func NewGetEventRequest(server string, eventId openapi_types.UUID) (*http.Request, error)
- func NewListEventsRequest(server string, params *ListEventsParams) (*http.Request, error)
- func NewListUsageRequest(server string, params *ListUsageParams) (*http.Request, error)
- func NewRecordEventRequestWithApplicationVndAPIPlusJSONBody(server string, params *RecordEventParams, ...) (*http.Request, error)
- func NewRecordEventRequestWithBody(server string, params *RecordEventParams, contentType string, body io.Reader) (*http.Request, error)
- type Client
- func (c *Client) GetEvent(ctx context.Context, eventId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) ListEvents(ctx context.Context, params *ListEventsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) ListUsage(ctx context.Context, params *ListUsageParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) RecordEventWithApplicationVndAPIPlusJSONBody(ctx context.Context, params *RecordEventParams, ...) (*http.Response, error)
- func (c *Client) RecordEventWithBody(ctx context.Context, params *RecordEventParams, contentType string, ...) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) GetEventWithResponse(ctx context.Context, eventId openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetEventResponse, error)
- func (c *ClientWithResponses) ListEventsWithResponse(ctx context.Context, params *ListEventsParams, reqEditors ...RequestEditorFn) (*ListEventsResponse, error)
- func (c *ClientWithResponses) ListUsageWithResponse(ctx context.Context, params *ListUsageParams, reqEditors ...RequestEditorFn) (*ListUsageResponse, error)
- func (c *ClientWithResponses) RecordEventWithApplicationVndAPIPlusJSONBodyWithResponse(ctx context.Context, params *RecordEventParams, ...) (*RecordEventResponse, error)
- func (c *ClientWithResponses) RecordEventWithBodyWithResponse(ctx context.Context, params *RecordEventParams, contentType string, ...) (*RecordEventResponse, error)
- type ClientWithResponsesInterface
- type Event
- type EventListLinks
- type EventListMeta
- type EventListResponse
- type EventResource
- type EventResponse
- type GetEventResponse
- type HttpRequestDoer
- type ListEventsParams
- type ListEventsResponse
- type ListUsageParams
- type ListUsageResponse
- type RecordEventApplicationVndAPIPlusJSONRequestBody
- type RecordEventParams
- type RecordEventResponse
- type RequestEditorFn
- type UsageResource
- type UsageResponse
Constants ¶
const (
HTTPBearerScopes hTTPBearerContextKey = "HTTPBearer.Scopes"
)
Variables ¶
This section is empty.
Functions ¶
func NewGetEventRequest ¶
NewGetEventRequest generates requests for GetEvent
func NewListEventsRequest ¶
func NewListEventsRequest(server string, params *ListEventsParams) (*http.Request, error)
NewListEventsRequest generates requests for ListEvents
func NewListUsageRequest ¶
func NewListUsageRequest(server string, params *ListUsageParams) (*http.Request, error)
NewListUsageRequest generates requests for ListUsage
func NewRecordEventRequestWithApplicationVndAPIPlusJSONBody ¶ added in v3.0.12
func NewRecordEventRequestWithApplicationVndAPIPlusJSONBody(server string, params *RecordEventParams, body RecordEventApplicationVndAPIPlusJSONRequestBody) (*http.Request, error)
NewRecordEventRequestWithApplicationVndAPIPlusJSONBody calls the generic RecordEvent builder with application/vnd.api+json body
func NewRecordEventRequestWithBody ¶ added in v3.0.12
func NewRecordEventRequestWithBody(server string, params *RecordEventParams, contentType string, body io.Reader) (*http.Request, error)
NewRecordEventRequestWithBody generates requests for RecordEvent with any type of body
Types ¶
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) GetEvent ¶
func (c *Client) GetEvent(ctx context.Context, eventId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) ListEvents ¶
func (c *Client) ListEvents(ctx context.Context, params *ListEventsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) ListUsage ¶
func (c *Client) ListUsage(ctx context.Context, params *ListUsageParams, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) RecordEventWithApplicationVndAPIPlusJSONBody ¶ added in v3.0.12
func (c *Client) RecordEventWithApplicationVndAPIPlusJSONBody(ctx context.Context, params *RecordEventParams, body RecordEventApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) RecordEventWithBody ¶ added in v3.0.12
type ClientInterface ¶
type ClientInterface interface {
// ListEvents request
ListEvents(ctx context.Context, params *ListEventsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// RecordEventWithBody request with any body
RecordEventWithBody(ctx context.Context, params *RecordEventParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
RecordEventWithApplicationVndAPIPlusJSONBody(ctx context.Context, params *RecordEventParams, body RecordEventApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetEvent request
GetEvent(ctx context.Context, eventId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error)
// ListUsage request
ListUsage(ctx context.Context, params *ListUsageParams, 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) GetEventWithResponse ¶
func (c *ClientWithResponses) GetEventWithResponse(ctx context.Context, eventId openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetEventResponse, error)
GetEventWithResponse request returning *GetEventResponse
func (*ClientWithResponses) ListEventsWithResponse ¶
func (c *ClientWithResponses) ListEventsWithResponse(ctx context.Context, params *ListEventsParams, reqEditors ...RequestEditorFn) (*ListEventsResponse, error)
ListEventsWithResponse request returning *ListEventsResponse
func (*ClientWithResponses) ListUsageWithResponse ¶
func (c *ClientWithResponses) ListUsageWithResponse(ctx context.Context, params *ListUsageParams, reqEditors ...RequestEditorFn) (*ListUsageResponse, error)
ListUsageWithResponse request returning *ListUsageResponse
func (*ClientWithResponses) RecordEventWithApplicationVndAPIPlusJSONBodyWithResponse ¶ added in v3.0.12
func (c *ClientWithResponses) RecordEventWithApplicationVndAPIPlusJSONBodyWithResponse(ctx context.Context, params *RecordEventParams, body RecordEventApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*RecordEventResponse, error)
func (*ClientWithResponses) RecordEventWithBodyWithResponse ¶ added in v3.0.12
func (c *ClientWithResponses) RecordEventWithBodyWithResponse(ctx context.Context, params *RecordEventParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RecordEventResponse, error)
RecordEventWithBodyWithResponse request with arbitrary body returning *RecordEventResponse
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface {
// ListEventsWithResponse request
ListEventsWithResponse(ctx context.Context, params *ListEventsParams, reqEditors ...RequestEditorFn) (*ListEventsResponse, error)
// RecordEventWithBodyWithResponse request with any body
RecordEventWithBodyWithResponse(ctx context.Context, params *RecordEventParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RecordEventResponse, error)
RecordEventWithApplicationVndAPIPlusJSONBodyWithResponse(ctx context.Context, params *RecordEventParams, body RecordEventApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*RecordEventResponse, error)
// GetEventWithResponse request
GetEventWithResponse(ctx context.Context, eventId openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetEventResponse, error)
// ListUsageWithResponse request
ListUsageWithResponse(ctx context.Context, params *ListUsageParams, reqEditors ...RequestEditorFn) (*ListUsageResponse, error)
}
ClientWithResponsesInterface is the interface specification for the client with responses above.
type Event ¶
type Event struct {
Action string `json:"action"`
ActorId *openapi_types.UUID `json:"actor_id,omitempty"`
ActorLabel *string `json:"actor_label,omitempty"`
ActorType *string `json:"actor_type,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
Data *map[string]interface{} `json:"data,omitempty"`
IdempotencyKey *string `json:"idempotency_key,omitempty"`
OccurredAt *time.Time `json:"occurred_at,omitempty"`
ResourceId string `json:"resource_id"`
ResourceType string `json:"resource_type"`
Snapshot *map[string]interface{} `json:"snapshot,omitempty"`
}
Event Public-facing event resource.
Attribute set on POST /api/v1/events:
- action (required)
- resource_type (required)
- resource_id (required)
- occurred_at (optional; defaults to “created_at“)
- snapshot (optional)
- data (optional; defaults to “{}“)
Attribute set on GET responses includes everything above plus the server-populated fields: “created_at“, “actor_type“, “actor_id“, “actor_label“, “idempotency_key“.
type EventListLinks ¶
type EventListLinks struct {
Next *string `json:"next,omitempty"`
}
EventListLinks defines model for EventListLinks.
type EventListMeta ¶
type EventListMeta struct {
PageSize int `json:"page_size"`
}
EventListMeta defines model for EventListMeta.
type EventListResponse ¶
type EventListResponse struct {
Data []EventResource `json:"data"`
Links *EventListLinks `json:"links,omitempty"`
Meta EventListMeta `json:"meta"`
}
EventListResponse JSON:API collection response with cursor pagination metadata.
type EventResource ¶
type EventResource struct {
// Attributes Public-facing event resource.
//
// Attribute set on POST /api/v1/events:
// - action (required)
// - resource_type (required)
// - resource_id (required)
// - occurred_at (optional; defaults to “created_at“)
// - snapshot (optional)
// - data (optional; defaults to “{}“)
//
// Attribute set on GET responses includes everything above plus the
// server-populated fields: “created_at“, “actor_type“, “actor_id“,
// “actor_label“, “idempotency_key“.
Attributes Event `json:"attributes"`
Id string `json:"id"`
Type *string `json:"type,omitempty"`
}
EventResource JSON:API resource envelope for an audit event.
type EventResponse ¶
type EventResponse struct {
// Data JSON:API resource envelope for an audit event.
Data EventResource `json:"data"`
}
EventResponse JSON:API single-resource response.
type GetEventResponse ¶
type GetEventResponse struct {
Body []byte
HTTPResponse *http.Response
ApplicationvndApiJSON200 *EventResponse
}
func ParseGetEventResponse ¶
func ParseGetEventResponse(rsp *http.Response) (*GetEventResponse, error)
ParseGetEventResponse parses an HTTP response from a GetEventWithResponse call
func (GetEventResponse) ContentType ¶
func (r GetEventResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (GetEventResponse) Status ¶
func (r GetEventResponse) Status() string
Status returns HTTPResponse.Status
func (GetEventResponse) StatusCode ¶
func (r GetEventResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type ListEventsParams ¶
type ListEventsParams struct {
FilterOccurredAt *string `form:"filter[occurred_at],omitempty" json:"filter[occurred_at],omitempty"`
FilterActorType *string `form:"filter[actor_type],omitempty" json:"filter[actor_type],omitempty"`
FilterActorId *openapi_types.UUID `form:"filter[actor_id],omitempty" json:"filter[actor_id],omitempty"`
FilterAction *string `form:"filter[action],omitempty" json:"filter[action],omitempty"`
FilterResourceType *string `form:"filter[resource_type],omitempty" json:"filter[resource_type],omitempty"`
FilterResourceId *string `form:"filter[resource_id],omitempty" json:"filter[resource_id],omitempty"`
PageSize *int `form:"page[size],omitempty" json:"page[size],omitempty"`
PageAfter *string `form:"page[after],omitempty" json:"page[after],omitempty"`
}
ListEventsParams defines parameters for ListEvents.
type ListEventsResponse ¶
type ListEventsResponse struct {
Body []byte
HTTPResponse *http.Response
ApplicationvndApiJSON200 *EventListResponse
}
func ParseListEventsResponse ¶
func ParseListEventsResponse(rsp *http.Response) (*ListEventsResponse, error)
ParseListEventsResponse parses an HTTP response from a ListEventsWithResponse call
func (ListEventsResponse) ContentType ¶
func (r ListEventsResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (ListEventsResponse) Status ¶
func (r ListEventsResponse) Status() string
Status returns HTTPResponse.Status
func (ListEventsResponse) StatusCode ¶
func (r ListEventsResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type ListUsageParams ¶
type ListUsageParams struct {
FilterPeriod string `form:"filter[period]" json:"filter[period]"`
}
ListUsageParams defines parameters for ListUsage.
type ListUsageResponse ¶
type ListUsageResponse struct {
Body []byte
HTTPResponse *http.Response
ApplicationvndApiJSON200 *UsageResponse
}
func ParseListUsageResponse ¶
func ParseListUsageResponse(rsp *http.Response) (*ListUsageResponse, error)
ParseListUsageResponse parses an HTTP response from a ListUsageWithResponse call
func (ListUsageResponse) ContentType ¶
func (r ListUsageResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (ListUsageResponse) Status ¶
func (r ListUsageResponse) Status() string
Status returns HTTPResponse.Status
func (ListUsageResponse) StatusCode ¶
func (r ListUsageResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type RecordEventApplicationVndAPIPlusJSONRequestBody ¶ added in v3.0.12
type RecordEventApplicationVndAPIPlusJSONRequestBody = EventResponse
RecordEventApplicationVndAPIPlusJSONRequestBody defines body for RecordEvent for application/vnd.api+json ContentType.
type RecordEventParams ¶ added in v3.0.12
type RecordEventParams struct {
IdempotencyKey *string `json:"Idempotency-Key,omitempty"`
}
RecordEventParams defines parameters for RecordEvent.
type RecordEventResponse ¶ added in v3.0.12
type RecordEventResponse struct {
Body []byte
HTTPResponse *http.Response
ApplicationvndApiJSON200 *EventResponse
ApplicationvndApiJSON201 *EventResponse
}
func ParseRecordEventResponse ¶ added in v3.0.12
func ParseRecordEventResponse(rsp *http.Response) (*RecordEventResponse, error)
ParseRecordEventResponse parses an HTTP response from a RecordEventWithResponse call
func (RecordEventResponse) ContentType ¶ added in v3.0.12
func (r RecordEventResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (RecordEventResponse) Status ¶ added in v3.0.12
func (r RecordEventResponse) Status() string
Status returns HTTPResponse.Status
func (RecordEventResponse) StatusCode ¶ added in v3.0.12
func (r RecordEventResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type UsageResource ¶
type UsageResource struct {
Attributes map[string]interface{} `json:"attributes"`
Id string `json:"id"`
Type *string `json:"type,omitempty"`
}
UsageResource defines model for UsageResource.
type UsageResponse ¶
type UsageResponse struct {
Data []UsageResource `json:"data"`
}
UsageResponse defines model for UsageResponse.