audit

package
v3.0.10 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 11 Imported by: 0

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

View Source
const (
	HTTPBearerScopes hTTPBearerContextKey = "HTTPBearer.Scopes"
)

Variables

This section is empty.

Functions

func NewCreateEventRequestWithApplicationVndAPIPlusJSONBody

func NewCreateEventRequestWithApplicationVndAPIPlusJSONBody(server string, params *CreateEventParams, body CreateEventApplicationVndAPIPlusJSONRequestBody) (*http.Request, error)

NewCreateEventRequestWithApplicationVndAPIPlusJSONBody calls the generic CreateEvent builder with application/vnd.api+json body

func NewCreateEventRequestWithBody

func NewCreateEventRequestWithBody(server string, params *CreateEventParams, contentType string, body io.Reader) (*http.Request, error)

NewCreateEventRequestWithBody generates requests for CreateEvent with any type of body

func NewGetEventRequest

func NewGetEventRequest(server string, eventId openapi_types.UUID) (*http.Request, error)

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

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

func (c *Client) CreateEventWithApplicationVndAPIPlusJSONBody(ctx context.Context, params *CreateEventParams, body CreateEventApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) CreateEventWithBody

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

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)

type ClientInterface

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

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

	CreateEventWithApplicationVndAPIPlusJSONBody(ctx context.Context, params *CreateEventParams, body CreateEventApplicationVndAPIPlusJSONRequestBody, 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

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

func (c *ClientWithResponses) CreateEventWithApplicationVndAPIPlusJSONBodyWithResponse(ctx context.Context, params *CreateEventParams, body CreateEventApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateEventResponse, error)

func (*ClientWithResponses) CreateEventWithBodyWithResponse

func (c *ClientWithResponses) CreateEventWithBodyWithResponse(ctx context.Context, params *CreateEventParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateEventResponse, error)

CreateEventWithBodyWithResponse request with arbitrary body returning *CreateEventResponse

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

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// ListEventsWithResponse request
	ListEventsWithResponse(ctx context.Context, params *ListEventsParams, reqEditors ...RequestEditorFn) (*ListEventsResponse, error)

	// CreateEventWithBodyWithResponse request with any body
	CreateEventWithBodyWithResponse(ctx context.Context, params *CreateEventParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateEventResponse, error)

	CreateEventWithApplicationVndAPIPlusJSONBodyWithResponse(ctx context.Context, params *CreateEventParams, body CreateEventApplicationVndAPIPlusJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateEventResponse, 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 CreateEventApplicationVndAPIPlusJSONRequestBody

type CreateEventApplicationVndAPIPlusJSONRequestBody = EventResponse

CreateEventApplicationVndAPIPlusJSONRequestBody defines body for CreateEvent for application/vnd.api+json ContentType.

type CreateEventParams

type CreateEventParams struct {
	IdempotencyKey *string `json:"Idempotency-Key,omitempty"`
}

CreateEventParams defines parameters for CreateEvent.

type CreateEventResponse

type CreateEventResponse struct {
	Body                     []byte
	HTTPResponse             *http.Response
	ApplicationvndApiJSON200 *EventResponse
	ApplicationvndApiJSON201 *EventResponse
}

func ParseCreateEventResponse

func ParseCreateEventResponse(rsp *http.Response) (*CreateEventResponse, error)

ParseCreateEventResponse parses an HTTP response from a CreateEventWithResponse call

func (CreateEventResponse) ContentType

func (r CreateEventResponse) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (CreateEventResponse) Status

func (r CreateEventResponse) Status() string

Status returns HTTPResponse.Status

func (CreateEventResponse) StatusCode

func (r CreateEventResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

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

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

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 RequestEditorFn

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

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.

Jump to

Keyboard shortcuts

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