Documentation ¶
Overview ¶
Code generated by apigen; DO NOT EDIT.
Index ¶
- Constants
- Variables
- type APIError
- type AvailableLogTypes
- type DelCustomLogInput
- type DelCustomLogOutput
- type DeletedCustomLogs
- type DynamoDBSchemas
- type ErrorReply
- type GetCustomLogInput
- type GetCustomLogOutput
- type GetSchemaInput
- type GetSchemaOutput
- type InMemDB
- type ListCustomLogsOutput
- type ListManagedSchemaUpdatesInput
- type ListManagedSchemaUpdatesOutput
- 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) GetSchema(ctx context.Context, input *GetSchemaInput) (*GetSchemaOutput, 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) ListManagedSchemaUpdates(ctx context.Context, _ *ListManagedSchemaUpdatesInput) (*ListManagedSchemaUpdatesOutput, error)
- func (api *LogTypesAPI) PutCustomLog(ctx context.Context, input *PutCustomLogInput) (*PutCustomLogOutput, error)
- func (api *LogTypesAPI) UpdateManagedSchemas(ctx context.Context, input *UpdateManagedSchemasInput) (*UpdateManagedSchemasOutput, 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) GetSchema(ctx context.Context, input *GetSchemaInput) (*GetSchemaOutput, 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) ListManagedSchemaUpdates(ctx context.Context, input *ListManagedSchemaUpdatesInput) (*ListManagedSchemaUpdatesOutput, error)
- func (c *LogTypesAPILambdaClient) PutCustomLog(ctx context.Context, input *PutCustomLogInput) (*PutCustomLogOutput, error)
- func (c *LogTypesAPILambdaClient) UpdateManagedSchemas(ctx context.Context, input *UpdateManagedSchemasInput) (*UpdateManagedSchemasOutput, error)
- type LogTypesAPIPayload
- type PutCustomLogInput
- type PutCustomLogOutput
- type Resolver
- type ScanSchemaFunc
- type SchemaDatabase
- type SchemaRecord
- type UpdateManagedSchemasInput
- type UpdateManagedSchemasOutput
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" 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 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 DynamoDBSchemas ¶ added in v1.16.0
type DynamoDBSchemas struct { DB dynamodbiface.DynamoDBAPI TableName string }
DynamoDBSchemas provides logtypes api actions for DDB
func (*DynamoDBSchemas) GetSchema ¶ added in v1.16.0
func (d *DynamoDBSchemas) GetSchema(ctx context.Context, id string) (*SchemaRecord, error)
func (*DynamoDBSchemas) PutSchema ¶ added in v1.16.0
func (d *DynamoDBSchemas) PutSchema(ctx context.Context, id string, record *SchemaRecord) (*SchemaRecord, error)
nolint:lll
func (*DynamoDBSchemas) ScanSchemas ¶ added in v1.16.0
func (d *DynamoDBSchemas) ScanSchemas(ctx context.Context, scan ScanSchemaFunc) 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"`
}
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 *SchemaRecord `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 GetSchemaInput ¶ added in v1.16.0
type GetSchemaInput struct {
Name string `json:"name" validate:"required" description:"The schema id"`
}
GetSchemaInput specifies the schema id and revision to retrieve. Zero Revision will get the latest revision of the schema record
type GetSchemaOutput ¶ added in v1.16.0
type GetSchemaOutput struct { Record *SchemaRecord `json:"record,omitempty" description:"The schema 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 SchemaDatabase. It is useful for tests and for caching results of another implementation.
func NewInMemory ¶ added in v1.15.0
func NewInMemory() *InMemDB
func (*InMemDB) PutSchema ¶ added in v1.16.0
func (db *InMemDB) PutSchema(_ context.Context, name string, r *SchemaRecord) (*SchemaRecord, error)
func (*InMemDB) ScanSchemas ¶ added in v1.16.0
func (db *InMemDB) ScanSchemas(_ context.Context, scan ScanSchemaFunc) error
type ListCustomLogsOutput ¶ added in v1.15.0
type ListCustomLogsOutput struct { Records []*SchemaRecord `json:"customLogs" description:"Custom log records stored"` Error *APIError `json:"error,omitempty" description:"An error that occurred during the operation"` }
type ListManagedSchemaUpdatesInput ¶ added in v1.16.0
type ListManagedSchemaUpdatesInput struct{}
type ListManagedSchemaUpdatesOutput ¶ added in v1.16.0
type ListManagedSchemaUpdatesOutput struct { Releases *[]managedschemas.Release `json:"releases,omitempty" description:"Available release updates"` Error *APIError `json:"error,omitempty" description:"An error that occurred while fetching the record"` }
type LogTypesAPI ¶
type LogTypesAPI struct { Database SchemaDatabase UpdateDataCatalog func(ctx context.Context, logType string, from, to []logschema.FieldSchema) error LogTypesInUse func(ctx context.Context) ([]string, error) ManagedSchemas managedschemas.ReleaseFeeder }
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) GetSchema ¶ added in v1.16.0
func (api *LogTypesAPI) GetSchema(ctx context.Context, input *GetSchemaInput) (*GetSchemaOutput, error)
GetSchema gets a schema record
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) ListManagedSchemaUpdates ¶ added in v1.16.0
func (api *LogTypesAPI) ListManagedSchemaUpdates(ctx context.Context, _ *ListManagedSchemaUpdatesInput) (*ListManagedSchemaUpdatesOutput, error)
nolint:lll
func (*LogTypesAPI) PutCustomLog ¶ added in v1.15.0
func (api *LogTypesAPI) PutCustomLog(ctx context.Context, input *PutCustomLogInput) (*PutCustomLogOutput, error)
func (*LogTypesAPI) UpdateManagedSchemas ¶ added in v1.16.0
func (api *LogTypesAPI) UpdateManagedSchemas(ctx context.Context, input *UpdateManagedSchemasInput) (*UpdateManagedSchemasOutput, 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) GetSchema ¶ added in v1.16.0
func (c *LogTypesAPILambdaClient) GetSchema(ctx context.Context, input *GetSchemaInput) (*GetSchemaOutput, 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) ListManagedSchemaUpdates ¶ added in v1.16.0
func (c *LogTypesAPILambdaClient) ListManagedSchemaUpdates(ctx context.Context, input *ListManagedSchemaUpdatesInput) (*ListManagedSchemaUpdatesOutput, error)
func (*LogTypesAPILambdaClient) PutCustomLog ¶ added in v1.15.0
func (c *LogTypesAPILambdaClient) PutCustomLog(ctx context.Context, input *PutCustomLogInput) (*PutCustomLogOutput, error)
func (*LogTypesAPILambdaClient) UpdateManagedSchemas ¶ added in v1.16.0
func (c *LogTypesAPILambdaClient) UpdateManagedSchemas(ctx context.Context, input *UpdateManagedSchemasInput) (*UpdateManagedSchemasOutput, 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"` ListManagedSchemaUpdates *ListManagedSchemaUpdatesInput `json:"ListManagedSchemaUpdates,omitempty"` UpdateManagedSchemas *UpdateManagedSchemasInput `json:"UpdateManagedSchemas,omitempty"` GetSchema *GetSchemaInput `json:"GetSchema,omitempty"` }
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 */ Description string `json:"description" description:"Log type description"` ReferenceURL string `json:"referenceURL" description:"A URL with reference docs for the schema"` // For compatibility we use 'logSpec' as the JSON and DDB field names Spec string `json:"logSpec" dynamodbav:"logSpec" validate:"required" description:"The schema spec in YAML or JSON format"` }
nolint:lll
type PutCustomLogOutput ¶ added in v1.15.0
type PutCustomLogOutput struct { Result *SchemaRecord `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 NativeLogTypes logtypes.Finder }
Resolver resolves a log type entry using the API
type ScanSchemaFunc ¶ added in v1.16.0
type ScanSchemaFunc func(r *SchemaRecord) bool
type SchemaDatabase ¶ added in v1.16.0
type SchemaDatabase interface { // GetSchema gets a single schema record GetSchema(ctx context.Context, id string) (*SchemaRecord, error) // PutSchema puts a single schema record PutSchema(ctx context.Context, id string, record *SchemaRecord) (*SchemaRecord, error) // ScanSchemas iterates through all schema records as long as scan returns true ScanSchemas(ctx context.Context, scan ScanSchemaFunc) error }
SchemaDatabase handles the external actions required for LogTypesAPI to be implemented
type SchemaRecord ¶ added in v1.16.0
type SchemaRecord struct { // For compatibility we use 'logType' as the DDB field name Name string `json:"logType" dynamodbav:"logType" validate:"required" description:"The schema id"` Revision int64 `json:"revision" validate:"required,min=1" description:"Schema record revision"` Release string `json:"release,omitempty" description:"Managed schema release version"` UpdatedAt time.Time `json:"updatedAt" description:"Last update timestamp of the record"` CreatedAt time.Time `json:"createdAt" description:"Creation timestamp of the record"` Managed bool `json:"managed,omitempty" description:"Schema is managed by Panther"` // For compatibility we use 'IsDeleted' as the DDB field name Disabled bool `json:"disabled,omitempty" dynamodbav:"IsDeleted" description:"Log record is deleted"` Description string `json:"description" description:"Log type description"` ReferenceURL string `json:"referenceURL" description:"A URL with reference docs for the schema"` // For compatibility we use 'logSpec' as the JSON and DDB field names Spec string `json:"logSpec" dynamodbav:"logSpec" validate:"required" description:"The schema spec in YAML or JSON format"` }
SchemaRecord describes a stored schema.
A SchemaRecord can either be managed or user-defined. Managed schema records have their Managed field set to `true` and include a version tag in Release field. User-defined schema records have Managed and Release fields missing.
func (*SchemaRecord) IsCustom ¶ added in v1.16.0
func (r *SchemaRecord) IsCustom() bool
IsCustom checks the schema record name to determine if it is for a user-defined schema
func (*SchemaRecord) IsManaged ¶ added in v1.16.0
func (r *SchemaRecord) IsManaged() bool
IsManaged checks if a schema record is managed by Panther
type UpdateManagedSchemasInput ¶ added in v1.16.0
type UpdateManagedSchemasOutput ¶ added in v1.16.0
type UpdateManagedSchemasOutput struct { Records []*SchemaRecord `json:"records"` Error *APIError `json:"error,omitempty" description:"An error that occurred while fetching the record"` }