Documentation
¶
Overview ¶
Code generated by apigen; DO NOT EDIT.
Index ¶
- Constants
- Variables
- type APIError
- type AvailableLogTypes
- type CustomLog
- type CustomLogRecord
- type DelCustomLogInput
- type DelCustomLogOutput
- type DeletedCustomLogs
- type DynamoDBLogTypes
- func (d *DynamoDBLogTypes) BatchGetCustomLogs(ctx context.Context, ids ...string) ([]*CustomLogRecord, error)
- func (d *DynamoDBLogTypes) CreateCustomLog(ctx context.Context, id string, params *CustomLog) (*CustomLogRecord, error)
- func (d *DynamoDBLogTypes) DeleteCustomLog(ctx context.Context, id string, revision int64) error
- func (d *DynamoDBLogTypes) GetCustomLog(ctx context.Context, id string, revision int64) (*CustomLogRecord, error)
- func (d *DynamoDBLogTypes) IndexLogTypes(ctx context.Context) ([]string, error)
- func (d *DynamoDBLogTypes) ListDeletedLogTypes(ctx context.Context) ([]string, error)
- func (d *DynamoDBLogTypes) UpdateCustomLog(ctx context.Context, id string, revision int64, params *CustomLog) (*CustomLogRecord, error)
- type ErrorReply
- type GetCustomLogInput
- type GetCustomLogOutput
- type InMemDB
- func (db *InMemDB) BatchGetCustomLogs(ctx context.Context, ids ...string) ([]*CustomLogRecord, error)
- func (db *InMemDB) CreateCustomLog(_ context.Context, id string, params *CustomLog) (*CustomLogRecord, error)
- func (db *InMemDB) DeleteCustomLog(_ context.Context, id string, revision int64) error
- func (db *InMemDB) GetCustomLog(_ context.Context, id string, revision int64) (*CustomLogRecord, error)
- func (db *InMemDB) IndexLogTypes(_ context.Context) ([]string, error)
- func (db *InMemDB) ListDeletedLogTypes(ctx context.Context) ([]string, error)
- func (db *InMemDB) UpdateCustomLog(_ context.Context, id string, revision int64, params *CustomLog) (*CustomLogRecord, error)
- type ListCustomLogsOutput
- type LogTypesAPI
- func (api *LogTypesAPI) DelCustomLog(ctx context.Context, input *DelCustomLogInput) (*DelCustomLogOutput, error)
- func (api *LogTypesAPI) GetCustomLog(ctx context.Context, input *GetCustomLogInput) (*GetCustomLogOutput, error)
- func (api *LogTypesAPI) ListAvailableLogTypes(ctx context.Context) (*AvailableLogTypes, error)
- func (api *LogTypesAPI) ListCustomLogs(ctx context.Context) (*ListCustomLogsOutput, error)
- func (api *LogTypesAPI) ListDeletedCustomLogs(ctx context.Context) (*DeletedCustomLogs, error)
- func (api *LogTypesAPI) PutCustomLog(ctx context.Context, input *PutCustomLogInput) (*PutCustomLogOutput, error)
- type LogTypesAPILambdaClient
- func (c *LogTypesAPILambdaClient) DelCustomLog(ctx context.Context, input *DelCustomLogInput) (*DelCustomLogOutput, error)
- func (c *LogTypesAPILambdaClient) GetCustomLog(ctx context.Context, input *GetCustomLogInput) (*GetCustomLogOutput, error)
- func (c *LogTypesAPILambdaClient) ListAvailableLogTypes(ctx context.Context) (*AvailableLogTypes, error)
- func (c *LogTypesAPILambdaClient) ListCustomLogs(ctx context.Context) (*ListCustomLogsOutput, error)
- func (c *LogTypesAPILambdaClient) ListDeletedCustomLogs(ctx context.Context) (*DeletedCustomLogs, error)
- func (c *LogTypesAPILambdaClient) PutCustomLog(ctx context.Context, input *PutCustomLogInput) (*PutCustomLogOutput, error)
- type LogTypesAPIPayload
- type LogTypesDatabase
- type PutCustomLogInput
- type PutCustomLogOutput
- type Resolver
Constants ¶
const ( // ErrRevisionConflict is the error code to use when there is a revision conflict ErrRevisionConflict = "RevisionConflict" ErrAlreadyExists = "AlreadyExists" ErrNotFound = "NotFound" ErrInUse = "InUse" ErrInvalidUpdate = "InvalidUpdate" ErrInvalidMetadata = "InvalidMetadata" ErrInvalidSyntax = "InvalidSyntax" ErrInvalidLogSchema = "InvalidLogSchema" ErrServerError = "ServerError" )
const LambdaName = "panther-logtypes-api"
Variables ¶
var L = lambdalogger.FromContext
Functions ¶
This section is empty.
Types ¶
type APIError ¶ added in v1.15.0
type APIError struct { Code string `json:"code" validate:"required"` Message string `json:"message" validate:"required"` // contains filtered or unexported fields }
APIError is an error that has a code and a message and is returned as part of the API response
func AsAPIError ¶ added in v1.15.0
func NewAPIError ¶ added in v1.15.0
NewAPIError creates a new API error
func WrapAPIError ¶ added in v1.15.0
type AvailableLogTypes ¶
type AvailableLogTypes struct {
LogTypes []string `json:"logTypes"`
}
type CustomLog ¶ added in v1.15.0
type CustomLog struct { Description string `json:"description" description:"Log type description"` ReferenceURL string `json:"referenceURL" description:"A URL with reference docs for the log type"` LogSpec string `json:"logSpec" validate:"required" description:"The log spec in YAML or JSON format"` }
type CustomLogRecord ¶ added in v1.15.0
type CustomLogRecord struct { LogType string `json:"logType" validate:"required,startswith=Custom." description:"The log type id"` Revision int64 `json:"revision" validate:"required,min=1" description:"Log record revision"` UpdatedAt time.Time `json:"updatedAt" description:"Last update timestamp of the record"` CustomLog }
CustomLogRecord is a stored record for a custom log type
type DelCustomLogInput ¶ added in v1.15.0
type DelCustomLogOutput ¶ added in v1.15.0
type DelCustomLogOutput struct {
Error *APIError `json:"error,omitempty" description:"The delete record"`
}
type DeletedCustomLogs ¶ added in v1.15.0
type DynamoDBLogTypes ¶
type DynamoDBLogTypes struct { DB dynamodbiface.DynamoDBAPI TableName string }
DynamoDBLogTypes provides logtypes api actions for DDB
func (*DynamoDBLogTypes) BatchGetCustomLogs ¶ added in v1.15.0
func (d *DynamoDBLogTypes) BatchGetCustomLogs(ctx context.Context, ids ...string) ([]*CustomLogRecord, error)
func (*DynamoDBLogTypes) CreateCustomLog ¶ added in v1.15.0
func (d *DynamoDBLogTypes) CreateCustomLog(ctx context.Context, id string, params *CustomLog) (*CustomLogRecord, error)
func (*DynamoDBLogTypes) DeleteCustomLog ¶ added in v1.15.0
func (*DynamoDBLogTypes) GetCustomLog ¶ added in v1.15.0
func (d *DynamoDBLogTypes) GetCustomLog(ctx context.Context, id string, revision int64) (*CustomLogRecord, error)
func (*DynamoDBLogTypes) IndexLogTypes ¶
func (d *DynamoDBLogTypes) IndexLogTypes(ctx context.Context) ([]string, error)
func (*DynamoDBLogTypes) ListDeletedLogTypes ¶ added in v1.15.0
func (d *DynamoDBLogTypes) ListDeletedLogTypes(ctx context.Context) ([]string, error)
func (*DynamoDBLogTypes) UpdateCustomLog ¶ added in v1.15.0
func (d *DynamoDBLogTypes) UpdateCustomLog(ctx context.Context, id string, revision int64, params *CustomLog) (*CustomLogRecord, error)
type ErrorReply ¶ added in v1.15.0
type ErrorReply struct {
Error *APIError `json:"error"`
}
type GetCustomLogInput ¶ added in v1.15.0
type GetCustomLogInput struct { LogType string `json:"logType" validate:"required,startswith=Custom." description:"The log type id"` Revision int64 `json:"revision,omitempty" validate:"omitempty,min=1" description:"Log record revision (0 means latest)"` }
GetCustomLogInput specifies the log type id and revision to retrieve. Zero Revision will get the latest revision of the log type record
type GetCustomLogOutput ¶ added in v1.15.0
type GetCustomLogOutput struct { Result *CustomLogRecord `json:"record,omitempty" description:"The custom log record (field omitted if an error occurred)"` Error *APIError `json:"error,omitempty" description:"An error that occurred while fetching the record"` }
type InMemDB ¶ added in v1.15.0
type InMemDB struct {
// contains filtered or unexported fields
}
InMemDB is an in-memory implementation of the LogTypesDatabase. It is useful for tests and for caching results of another implementation.
func NewInMemory ¶ added in v1.15.0
func NewInMemory() *InMemDB
func (*InMemDB) BatchGetCustomLogs ¶ added in v1.15.0
func (*InMemDB) CreateCustomLog ¶ added in v1.15.0
func (*InMemDB) DeleteCustomLog ¶ added in v1.15.0
func (*InMemDB) GetCustomLog ¶ added in v1.15.0
func (*InMemDB) IndexLogTypes ¶ added in v1.15.0
func (*InMemDB) ListDeletedLogTypes ¶ added in v1.15.0
func (*InMemDB) UpdateCustomLog ¶ added in v1.15.0
type ListCustomLogsOutput ¶ added in v1.15.0
type ListCustomLogsOutput struct { CustomLogs []*CustomLogRecord `json:"customLogs" description:"Custom log records stored"` Error *APIError `json:"error,omitempty" description:"An error that occurred during the operation"` }
type LogTypesAPI ¶
type LogTypesAPI struct { NativeLogTypes func() []string Database LogTypesDatabase UpdateDataCatalog func(ctx context.Context, logType string, from, to []logschema.FieldSchema) error // FIXME: Rename to LogTypesInUse LogTypeInUse func(ctx context.Context) ([]string, error) }
LogTypesAPI handles the business logic of log types LogTypesAPI
func (*LogTypesAPI) DelCustomLog ¶ added in v1.15.0
func (api *LogTypesAPI) DelCustomLog(ctx context.Context, input *DelCustomLogInput) (*DelCustomLogOutput, error)
func (*LogTypesAPI) GetCustomLog ¶ added in v1.15.0
func (api *LogTypesAPI) GetCustomLog(ctx context.Context, input *GetCustomLogInput) (*GetCustomLogOutput, error)
GetCustomLog gets a custom log record for the specified id and revision
func (*LogTypesAPI) ListAvailableLogTypes ¶
func (api *LogTypesAPI) ListAvailableLogTypes(ctx context.Context) (*AvailableLogTypes, error)
ListAvailableLogTypes lists all available log type ids
func (*LogTypesAPI) ListCustomLogs ¶ added in v1.15.0
func (api *LogTypesAPI) ListCustomLogs(ctx context.Context) (*ListCustomLogsOutput, error)
func (*LogTypesAPI) ListDeletedCustomLogs ¶ added in v1.15.0
func (api *LogTypesAPI) ListDeletedCustomLogs(ctx context.Context) (*DeletedCustomLogs, error)
ListDeletedCustomLogs lists all deleted log type ids
func (*LogTypesAPI) PutCustomLog ¶ added in v1.15.0
func (api *LogTypesAPI) PutCustomLog(ctx context.Context, input *PutCustomLogInput) (*PutCustomLogOutput, error)
type LogTypesAPILambdaClient ¶
type LogTypesAPILambdaClient struct { LambdaName string LambdaAPI lambdaiface.LambdaAPI Validate func(interface{}) error JSON jsoniter.API }
LogTypesAPILambdaClient implements LogTypesAPI by invoking a Lambda
func (*LogTypesAPILambdaClient) DelCustomLog ¶ added in v1.15.0
func (c *LogTypesAPILambdaClient) DelCustomLog(ctx context.Context, input *DelCustomLogInput) (*DelCustomLogOutput, error)
func (*LogTypesAPILambdaClient) GetCustomLog ¶ added in v1.15.0
func (c *LogTypesAPILambdaClient) GetCustomLog(ctx context.Context, input *GetCustomLogInput) (*GetCustomLogOutput, error)
func (*LogTypesAPILambdaClient) ListAvailableLogTypes ¶
func (c *LogTypesAPILambdaClient) ListAvailableLogTypes(ctx context.Context) (*AvailableLogTypes, error)
func (*LogTypesAPILambdaClient) ListCustomLogs ¶ added in v1.15.0
func (c *LogTypesAPILambdaClient) ListCustomLogs(ctx context.Context) (*ListCustomLogsOutput, error)
func (*LogTypesAPILambdaClient) ListDeletedCustomLogs ¶ added in v1.15.0
func (c *LogTypesAPILambdaClient) ListDeletedCustomLogs(ctx context.Context) (*DeletedCustomLogs, error)
func (*LogTypesAPILambdaClient) PutCustomLog ¶ added in v1.15.0
func (c *LogTypesAPILambdaClient) PutCustomLog(ctx context.Context, input *PutCustomLogInput) (*PutCustomLogOutput, error)
type LogTypesAPIPayload ¶
type LogTypesAPIPayload struct { ListAvailableLogTypes *struct{} `json:"ListAvailableLogTypes,omitempty"` ListDeletedCustomLogs *struct{} `json:"ListDeletedCustomLogs,omitempty"` GetCustomLog *GetCustomLogInput `json:"GetCustomLog,omitempty"` PutCustomLog *PutCustomLogInput `json:"PutCustomLog,omitempty"` DelCustomLog *DelCustomLogInput `json:"DelCustomLog,omitempty"` ListCustomLogs *struct{} `json:"ListCustomLogs,omitempty"` }
type LogTypesDatabase ¶
type LogTypesDatabase interface { // Return an index of available log types IndexLogTypes(ctx context.Context) ([]string, error) // Create a new custom log record CreateCustomLog(ctx context.Context, id string, params *CustomLog) (*CustomLogRecord, error) // Get a single custom log record GetCustomLog(ctx context.Context, id string, revision int64) (*CustomLogRecord, error) // Update a custom log record UpdateCustomLog(ctx context.Context, id string, currentRevision int64, params *CustomLog) (*CustomLogRecord, error) // Delete a custom log record DeleteCustomLog(ctx context.Context, id string, currentRevision int64) error // Get multiple custom log records at their latest revision BatchGetCustomLogs(ctx context.Context, ids ...string) ([]*CustomLogRecord, error) // List deleted log types ListDeletedLogTypes(ctx context.Context) ([]string, error) }
LogTypesDatabase handles the external actions required for LogTypesAPI to be implemented
type PutCustomLogInput ¶ added in v1.15.0
type PutCustomLogInput struct { LogType string `json:"logType" validate:"required,startswith=Custom." description:"The log type id"` // Revision is required when updating a custom log record. // If is omitted a new custom log record will be created. Revision int64 `` /* 145-byte string literal not displayed */ CustomLog }
nolint:lll
type PutCustomLogOutput ¶ added in v1.15.0
type PutCustomLogOutput struct { Result *CustomLogRecord `json:"record,omitempty" description:"The modified record (field is omitted if an error occurred)"` Error *APIError `json:"error,omitempty" description:"An error that occurred during the operation"` }
type Resolver ¶ added in v1.15.0
type Resolver struct {
LogTypesAPI *LogTypesAPILambdaClient
}
Resolver resolves a custom log type using the API