Documentation ¶
Index ¶
- Constants
- type Asset
- type AssetClassification
- type AssetCloud
- type AssetCloudAccount
- type AssetCloudInstance
- type AssetCloudMachine
- type AssetCloudProject
- type AssetCloudService
- type AssetEnricher
- func EmptyEnricher() AssetEnricher
- func WithCloud(cloud AssetCloud) AssetEnricher
- func WithHost(host AssetHost) AssetEnricher
- func WithIAM(iam AssetIAM) AssetEnricher
- func WithNetwork(network AssetNetwork) AssetEnricher
- func WithRawAsset(raw any) AssetEnricher
- func WithResourcePolicies(policies ...AssetResourcePolicy) AssetEnricher
- func WithTags(tags map[string]string) AssetEnricher
- type AssetEvent
- type AssetFetcher
- type AssetHost
- type AssetIAM
- type AssetInventory
- type AssetNetwork
- type AssetPublisher
- type AssetResourcePolicy
- type MockAssetEnricher
- type MockAssetEnricher_Execute_Call
- type MockAssetEnricher_Expecter
- type MockAssetFetcher
- type MockAssetFetcher_Expecter
- type MockAssetFetcher_Fetch_Call
- func (_c *MockAssetFetcher_Fetch_Call) Return() *MockAssetFetcher_Fetch_Call
- func (_c *MockAssetFetcher_Fetch_Call) Run(run func(ctx context.Context, assetChannel chan<- AssetEvent)) *MockAssetFetcher_Fetch_Call
- func (_c *MockAssetFetcher_Fetch_Call) RunAndReturn(run func(context.Context, chan<- AssetEvent)) *MockAssetFetcher_Fetch_Call
- type MockAssetPublisher
- type MockAssetPublisher_Expecter
- type MockAssetPublisher_PublishAll_Call
- func (_c *MockAssetPublisher_PublishAll_Call) Return() *MockAssetPublisher_PublishAll_Call
- func (_c *MockAssetPublisher_PublishAll_Call) Run(run func(_a0 []beat.Event)) *MockAssetPublisher_PublishAll_Call
- func (_c *MockAssetPublisher_PublishAll_Call) RunAndReturn(run func([]beat.Event)) *MockAssetPublisher_PublishAll_Call
Constants ¶
const ( CategoryInfrastructure assetCategory = "infrastructure" CategoryIdentity assetCategory = "identity" )
const ( SubCategoryCompute assetSubCategory = "compute" SubCategoryStorage assetSubCategory = "storage" SubCategoryCloudProviderAccount assetSubCategory = "cloud-provider-account" )
const ( TypeVirtualMachine assetType = "virtual-machine" TypeObjectStorage assetType = "object-storage" TypeUser assetType = "user" TypeServiceAccount assetType = "service-account" TypePermissions assetType = "permissions" )
const ( SubTypeEC2 assetSubType = "ec2" SubTypeS3 assetSubType = "s3" SubTypeIAM assetSubType = "iam" )
const (
AwsCloudProvider = "aws"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Asset ¶
type Asset struct { UUID string `json:"uuid"` Id string `json:"id"` Name string `json:"name"` AssetClassification Tags map[string]string `json:"tags"` Raw any `json:"raw"` }
Asset contains the identifiers of the asset
type AssetClassification ¶
type AssetClassification struct { Category assetCategory `json:"category"` SubCategory assetSubCategory `json:"sub_category"` Type assetType `json:"type"` SubType assetSubType `json:"sub_type"` }
AssetClassification holds the taxonomy of an asset
type AssetCloud ¶
type AssetCloud struct { AvailabilityZone *string `json:"availability_zone,omitempty"` Provider string `json:"provider,omitempty"` Region string `json:"region,omitempty"` Account AssetCloudAccount `json:"account"` Instance *AssetCloudInstance `json:"instance,omitempty"` Machine *AssetCloudMachine `json:"machine,omitempty"` Project *AssetCloudProject `json:"project,omitempty"` Service *AssetCloudService `json:"service,omitempty"` }
AssetCloud contains information about the cloud provider
type AssetCloudAccount ¶
type AssetCloudInstance ¶
type AssetCloudMachine ¶
type AssetCloudMachine struct {
MachineType string `json:"machine_type,omitempty"`
}
type AssetCloudProject ¶
type AssetCloudService ¶
type AssetCloudService struct {
Name string `json:"name,omitempty"`
}
type AssetEnricher ¶
type AssetEnricher func(asset *AssetEvent)
AssetEnricher functional builder function
func EmptyEnricher ¶
func EmptyEnricher() AssetEnricher
func WithCloud ¶
func WithCloud(cloud AssetCloud) AssetEnricher
func WithHost ¶
func WithHost(host AssetHost) AssetEnricher
func WithIAM ¶
func WithIAM(iam AssetIAM) AssetEnricher
func WithNetwork ¶
func WithNetwork(network AssetNetwork) AssetEnricher
func WithRawAsset ¶
func WithRawAsset(raw any) AssetEnricher
func WithResourcePolicies ¶
func WithResourcePolicies(policies ...AssetResourcePolicy) AssetEnricher
func WithTags ¶
func WithTags(tags map[string]string) AssetEnricher
type AssetEvent ¶
type AssetEvent struct { Asset Asset Network *AssetNetwork Cloud *AssetCloud Host *AssetHost IAM *AssetIAM ResourcePolicies []AssetResourcePolicy }
AssetEvent holds the whole asset
func NewAssetEvent ¶
func NewAssetEvent(c AssetClassification, id string, name string, enrichers ...AssetEnricher) AssetEvent
type AssetFetcher ¶
type AssetFetcher interface {
Fetch(ctx context.Context, assetChannel chan<- AssetEvent)
}
type AssetHost ¶
type AssetHost struct { Architecture string `json:"architecture"` ImageId *string `json:"imageId"` InstanceType string `json:"instance_type"` Platform string `json:"platform"` PlatformDetails *string `json:"platform_details"` }
AssetHost contains information of the asset in case it is a host
type AssetInventory ¶
type AssetInventory struct {
// contains filtered or unexported fields
}
func NewAssetInventory ¶
func NewAssetInventory(logger *logp.Logger, fetchers []AssetFetcher, publisher AssetPublisher, now func() time.Time) AssetInventory
func (*AssetInventory) Run ¶
func (a *AssetInventory) Run(ctx context.Context)
func (*AssetInventory) Stop ¶
func (a *AssetInventory) Stop()
type AssetNetwork ¶
type AssetNetwork struct { NetworkId *string `json:"network_id"` SubnetId *string `json:"subnet_id"` Ipv6Address *string `json:"ipv6_address"` PublicIpAddress *string `json:"public_ip_address"` PrivateIpAddress *string `json:"private_ip_address"` PublicDnsName *string `json:"public_dns_name"` PrivateDnsName *string `json:"private_dns_name"` }
AssetNetwork contains network information
type AssetPublisher ¶
type AssetResourcePolicy ¶
type AssetResourcePolicy struct { Version *string `json:"version,omitempty"` Id *string `json:"id,omitempty"` Effect string `json:"effect,omitempty"` Principal map[string]any `json:"principal,omitempty"` Action []string `json:"action,omitempty"` NotAction []string `json:"notAction,omitempty"` Resource []string `json:"resource,omitempty"` NoResource []string `json:"noResource,omitempty"` Condition map[string]any `json:"condition,omitempty"` }
AssetResourcePolicy maps security policies applied directly on resources
type MockAssetEnricher ¶
MockAssetEnricher is an autogenerated mock type for the AssetEnricher type
func NewMockAssetEnricher ¶
func NewMockAssetEnricher(t interface { mock.TestingT Cleanup(func()) }) *MockAssetEnricher
NewMockAssetEnricher creates a new instance of MockAssetEnricher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockAssetEnricher) EXPECT ¶
func (_m *MockAssetEnricher) EXPECT() *MockAssetEnricher_Expecter
func (*MockAssetEnricher) Execute ¶
func (_m *MockAssetEnricher) Execute(asset *AssetEvent)
Execute provides a mock function with given fields: asset
type MockAssetEnricher_Execute_Call ¶
MockAssetEnricher_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
func (*MockAssetEnricher_Execute_Call) Return ¶
func (_c *MockAssetEnricher_Execute_Call) Return() *MockAssetEnricher_Execute_Call
func (*MockAssetEnricher_Execute_Call) Run ¶
func (_c *MockAssetEnricher_Execute_Call) Run(run func(asset *AssetEvent)) *MockAssetEnricher_Execute_Call
func (*MockAssetEnricher_Execute_Call) RunAndReturn ¶
func (_c *MockAssetEnricher_Execute_Call) RunAndReturn(run func(*AssetEvent)) *MockAssetEnricher_Execute_Call
type MockAssetEnricher_Expecter ¶
type MockAssetEnricher_Expecter struct {
// contains filtered or unexported fields
}
func (*MockAssetEnricher_Expecter) Execute ¶
func (_e *MockAssetEnricher_Expecter) Execute(asset interface{}) *MockAssetEnricher_Execute_Call
Execute is a helper method to define mock.On call
- asset *AssetEvent
type MockAssetFetcher ¶
MockAssetFetcher is an autogenerated mock type for the AssetFetcher type
func NewMockAssetFetcher ¶
func NewMockAssetFetcher(t interface { mock.TestingT Cleanup(func()) }) *MockAssetFetcher
NewMockAssetFetcher creates a new instance of MockAssetFetcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockAssetFetcher) EXPECT ¶
func (_m *MockAssetFetcher) EXPECT() *MockAssetFetcher_Expecter
func (*MockAssetFetcher) Fetch ¶
func (_m *MockAssetFetcher) Fetch(ctx context.Context, assetChannel chan<- AssetEvent)
Fetch provides a mock function with given fields: ctx, assetChannel
type MockAssetFetcher_Expecter ¶
type MockAssetFetcher_Expecter struct {
// contains filtered or unexported fields
}
func (*MockAssetFetcher_Expecter) Fetch ¶
func (_e *MockAssetFetcher_Expecter) Fetch(ctx interface{}, assetChannel interface{}) *MockAssetFetcher_Fetch_Call
Fetch is a helper method to define mock.On call
- ctx context.Context
- assetChannel chan<- AssetEvent
type MockAssetFetcher_Fetch_Call ¶
MockAssetFetcher_Fetch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Fetch'
func (*MockAssetFetcher_Fetch_Call) Return ¶
func (_c *MockAssetFetcher_Fetch_Call) Return() *MockAssetFetcher_Fetch_Call
func (*MockAssetFetcher_Fetch_Call) Run ¶
func (_c *MockAssetFetcher_Fetch_Call) Run(run func(ctx context.Context, assetChannel chan<- AssetEvent)) *MockAssetFetcher_Fetch_Call
func (*MockAssetFetcher_Fetch_Call) RunAndReturn ¶
func (_c *MockAssetFetcher_Fetch_Call) RunAndReturn(run func(context.Context, chan<- AssetEvent)) *MockAssetFetcher_Fetch_Call
type MockAssetPublisher ¶
MockAssetPublisher is an autogenerated mock type for the AssetPublisher type
func NewMockAssetPublisher ¶
func NewMockAssetPublisher(t interface { mock.TestingT Cleanup(func()) }) *MockAssetPublisher
NewMockAssetPublisher creates a new instance of MockAssetPublisher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockAssetPublisher) EXPECT ¶
func (_m *MockAssetPublisher) EXPECT() *MockAssetPublisher_Expecter
func (*MockAssetPublisher) PublishAll ¶
func (_m *MockAssetPublisher) PublishAll(_a0 []beat.Event)
PublishAll provides a mock function with given fields: _a0
type MockAssetPublisher_Expecter ¶
type MockAssetPublisher_Expecter struct {
// contains filtered or unexported fields
}
func (*MockAssetPublisher_Expecter) PublishAll ¶
func (_e *MockAssetPublisher_Expecter) PublishAll(_a0 interface{}) *MockAssetPublisher_PublishAll_Call
PublishAll is a helper method to define mock.On call
- _a0 []beat.Event
type MockAssetPublisher_PublishAll_Call ¶
MockAssetPublisher_PublishAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PublishAll'
func (*MockAssetPublisher_PublishAll_Call) Return ¶
func (_c *MockAssetPublisher_PublishAll_Call) Return() *MockAssetPublisher_PublishAll_Call
func (*MockAssetPublisher_PublishAll_Call) Run ¶
func (_c *MockAssetPublisher_PublishAll_Call) Run(run func(_a0 []beat.Event)) *MockAssetPublisher_PublishAll_Call
func (*MockAssetPublisher_PublishAll_Call) RunAndReturn ¶
func (_c *MockAssetPublisher_PublishAll_Call) RunAndReturn(run func([]beat.Event)) *MockAssetPublisher_PublishAll_Call