inventory

package
v0.0.0-...-19bd712 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StorageBucketAssetType         = "storage.googleapis.com/Bucket"
	ComputeFirewallAssetType       = "compute.googleapis.com/Firewall"
	ComputeInstanceAssetType       = "compute.googleapis.com/Instance"
	ComputeNetworkAssetType        = "compute.googleapis.com/Network"
	ComputeBackendServiceAssetType = "compute.googleapis.com/RegionBackendService"
	ComputeSubnetworkAssetType     = "compute.googleapis.com/Subnetwork"
	ComputeDiskAssetType           = "compute.googleapis.com/Disk"
	DnsManagedZoneAssetType        = "dns.googleapis.com/ManagedZone"
	BigqueryDatasetAssetType       = "bigquery.googleapis.com/Dataset"
	BigqueryTableAssetType         = "bigquery.googleapis.com/Table"
	CrmProjectAssetType            = "cloudresourcemanager.googleapis.com/Project"
	CrmOrgAssetType                = "cloudresourcemanager.googleapis.com/Organization"
	CrmFolderAssetType             = "cloudresourcemanager.googleapis.com/Folder"
	ApiKeysKeyAssetType            = "apikeys.googleapis.com/Key"
	CloudKmsCryptoKeyAssetType     = "cloudkms.googleapis.com/CryptoKey"
	IamServiceAccountAssetType     = "iam.googleapis.com/ServiceAccount"
	IamServiceAccountKeyAssetType  = "iam.googleapis.com/ServiceAccountKey"
	SqlDatabaseInstanceAssetType   = "sqladmin.googleapis.com/Instance"
	LogBucketAssetType             = "logging.googleapis.com/LogBucket"
	LogSinkAssetType               = "logging.googleapis.com/LogSink"
	DataprocClusterAssetType       = "dataproc.googleapis.com/Cluster"
	MonitoringLogMetricAssetType   = "logging.googleapis.com/LogMetric"
	MonitoringAlertPolicyAssetType = "monitoring.googleapis.com/AlertPolicy"
	DnsPolicyAssetType             = "dns.googleapis.com/Policy"
	ServiceUsageAssetType          = "serviceusage.googleapis.com/Service"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetsInventoryWrapper

type AssetsInventoryWrapper struct {
	Close      func() error
	ListAssets func(ctx context.Context, req *assetpb.ListAssetsRequest, opts ...gax.CallOption) Iterator
}

type ExtendedGcpAsset

type ExtendedGcpAsset struct {
	*assetpb.Asset
	CloudAccount *fetching.CloudAccountMetadata
}

type GcpAssetIDs

type GcpAssetIDs struct {
	// contains filtered or unexported fields
}

type Iterator

type Iterator interface {
	Next() (*assetpb.Asset, error)
}

type LoggingAsset

type LoggingAsset struct {
	CloudAccount *fetching.CloudAccountMetadata
	LogSinks     []*ExtendedGcpAsset `json:"log_sinks,omitempty"`
}

type MockIterator

type MockIterator struct {
	mock.Mock
}

MockIterator is an autogenerated mock type for the Iterator type

func NewMockIterator

func NewMockIterator(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockIterator

NewMockIterator creates a new instance of MockIterator. 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 (*MockIterator) EXPECT

func (_m *MockIterator) EXPECT() *MockIterator_Expecter

func (*MockIterator) Next

func (_m *MockIterator) Next() (*assetpb.Asset, error)

Next provides a mock function with given fields:

type MockIterator_Expecter

type MockIterator_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockIterator_Expecter) Next

Next is a helper method to define mock.On call

type MockIterator_Next_Call

type MockIterator_Next_Call struct {
	*mock.Call
}

MockIterator_Next_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Next'

func (*MockIterator_Next_Call) Return

func (*MockIterator_Next_Call) Run

func (_c *MockIterator_Next_Call) Run(run func()) *MockIterator_Next_Call

func (*MockIterator_Next_Call) RunAndReturn

func (_c *MockIterator_Next_Call) RunAndReturn(run func() (*assetpb.Asset, error)) *MockIterator_Next_Call

type MockProviderInitializerAPI

type MockProviderInitializerAPI struct {
	mock.Mock
}

MockProviderInitializerAPI is an autogenerated mock type for the ProviderInitializerAPI type

func NewMockProviderInitializerAPI

func NewMockProviderInitializerAPI(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockProviderInitializerAPI

NewMockProviderInitializerAPI creates a new instance of MockProviderInitializerAPI. 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 (*MockProviderInitializerAPI) EXPECT

func (*MockProviderInitializerAPI) Init

Init provides a mock function with given fields: ctx, log, gcpConfig

type MockProviderInitializerAPI_Expecter

type MockProviderInitializerAPI_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockProviderInitializerAPI_Expecter) Init

func (_e *MockProviderInitializerAPI_Expecter) Init(ctx interface{}, log interface{}, gcpConfig interface{}) *MockProviderInitializerAPI_Init_Call

Init is a helper method to define mock.On call

  • ctx context.Context
  • log *logp.Logger
  • gcpConfig auth.GcpFactoryConfig

type MockProviderInitializerAPI_Init_Call

type MockProviderInitializerAPI_Init_Call struct {
	*mock.Call
}

MockProviderInitializerAPI_Init_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Init'

func (*MockProviderInitializerAPI_Init_Call) Return

func (*MockProviderInitializerAPI_Init_Call) Run

func (*MockProviderInitializerAPI_Init_Call) RunAndReturn

type MockServiceAPI

type MockServiceAPI struct {
	mock.Mock
}

MockServiceAPI is an autogenerated mock type for the ServiceAPI type

func NewMockServiceAPI

func NewMockServiceAPI(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockServiceAPI

NewMockServiceAPI creates a new instance of MockServiceAPI. 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 (*MockServiceAPI) Close

func (_m *MockServiceAPI) Close() error

Close provides a mock function with given fields:

func (*MockServiceAPI) EXPECT

func (*MockServiceAPI) ListAllAssetTypesByName

func (_m *MockServiceAPI) ListAllAssetTypesByName(ctx context.Context, assets []string) ([]*ExtendedGcpAsset, error)

ListAllAssetTypesByName provides a mock function with given fields: ctx, assets

func (*MockServiceAPI) ListLoggingAssets

func (_m *MockServiceAPI) ListLoggingAssets(ctx context.Context) ([]*LoggingAsset, error)

ListLoggingAssets provides a mock function with given fields: ctx

func (*MockServiceAPI) ListMonitoringAssets

func (_m *MockServiceAPI) ListMonitoringAssets(ctx context.Context, monitoringAssetTypes map[string][]string) ([]*MonitoringAsset, error)

ListMonitoringAssets provides a mock function with given fields: ctx, monitoringAssetTypes

func (*MockServiceAPI) ListProjectsAncestorsPolicies

func (_m *MockServiceAPI) ListProjectsAncestorsPolicies(ctx context.Context) ([]*ProjectPoliciesAsset, error)

ListProjectsAncestorsPolicies provides a mock function with given fields: ctx

func (*MockServiceAPI) ListServiceUsageAssets

func (_m *MockServiceAPI) ListServiceUsageAssets(ctx context.Context) ([]*ServiceUsageAsset, error)

ListServiceUsageAssets provides a mock function with given fields: ctx

type MockServiceAPI_Close_Call

type MockServiceAPI_Close_Call struct {
	*mock.Call
}

MockServiceAPI_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'

func (*MockServiceAPI_Close_Call) Return

func (*MockServiceAPI_Close_Call) Run

func (*MockServiceAPI_Close_Call) RunAndReturn

func (_c *MockServiceAPI_Close_Call) RunAndReturn(run func() error) *MockServiceAPI_Close_Call

type MockServiceAPI_Expecter

type MockServiceAPI_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockServiceAPI_Expecter) Close

Close is a helper method to define mock.On call

func (*MockServiceAPI_Expecter) ListAllAssetTypesByName

func (_e *MockServiceAPI_Expecter) ListAllAssetTypesByName(ctx interface{}, assets interface{}) *MockServiceAPI_ListAllAssetTypesByName_Call

ListAllAssetTypesByName is a helper method to define mock.On call

  • ctx context.Context
  • assets []string

func (*MockServiceAPI_Expecter) ListLoggingAssets

func (_e *MockServiceAPI_Expecter) ListLoggingAssets(ctx interface{}) *MockServiceAPI_ListLoggingAssets_Call

ListLoggingAssets is a helper method to define mock.On call

  • ctx context.Context

func (*MockServiceAPI_Expecter) ListMonitoringAssets

func (_e *MockServiceAPI_Expecter) ListMonitoringAssets(ctx interface{}, monitoringAssetTypes interface{}) *MockServiceAPI_ListMonitoringAssets_Call

ListMonitoringAssets is a helper method to define mock.On call

  • ctx context.Context
  • monitoringAssetTypes map[string][]string

func (*MockServiceAPI_Expecter) ListProjectsAncestorsPolicies

func (_e *MockServiceAPI_Expecter) ListProjectsAncestorsPolicies(ctx interface{}) *MockServiceAPI_ListProjectsAncestorsPolicies_Call

ListProjectsAncestorsPolicies is a helper method to define mock.On call

  • ctx context.Context

func (*MockServiceAPI_Expecter) ListServiceUsageAssets

func (_e *MockServiceAPI_Expecter) ListServiceUsageAssets(ctx interface{}) *MockServiceAPI_ListServiceUsageAssets_Call

ListServiceUsageAssets is a helper method to define mock.On call

  • ctx context.Context

type MockServiceAPI_ListAllAssetTypesByName_Call

type MockServiceAPI_ListAllAssetTypesByName_Call struct {
	*mock.Call
}

MockServiceAPI_ListAllAssetTypesByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAllAssetTypesByName'

func (*MockServiceAPI_ListAllAssetTypesByName_Call) Return

func (*MockServiceAPI_ListAllAssetTypesByName_Call) Run

func (*MockServiceAPI_ListAllAssetTypesByName_Call) RunAndReturn

type MockServiceAPI_ListLoggingAssets_Call

type MockServiceAPI_ListLoggingAssets_Call struct {
	*mock.Call
}

MockServiceAPI_ListLoggingAssets_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListLoggingAssets'

func (*MockServiceAPI_ListLoggingAssets_Call) Return

func (*MockServiceAPI_ListLoggingAssets_Call) Run

func (*MockServiceAPI_ListLoggingAssets_Call) RunAndReturn

type MockServiceAPI_ListMonitoringAssets_Call

type MockServiceAPI_ListMonitoringAssets_Call struct {
	*mock.Call
}

MockServiceAPI_ListMonitoringAssets_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListMonitoringAssets'

func (*MockServiceAPI_ListMonitoringAssets_Call) Return

func (*MockServiceAPI_ListMonitoringAssets_Call) Run

func (*MockServiceAPI_ListMonitoringAssets_Call) RunAndReturn

type MockServiceAPI_ListProjectsAncestorsPolicies_Call

type MockServiceAPI_ListProjectsAncestorsPolicies_Call struct {
	*mock.Call
}

MockServiceAPI_ListProjectsAncestorsPolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListProjectsAncestorsPolicies'

func (*MockServiceAPI_ListProjectsAncestorsPolicies_Call) Return

func (*MockServiceAPI_ListProjectsAncestorsPolicies_Call) Run

func (*MockServiceAPI_ListProjectsAncestorsPolicies_Call) RunAndReturn

type MockServiceAPI_ListServiceUsageAssets_Call

type MockServiceAPI_ListServiceUsageAssets_Call struct {
	*mock.Call
}

MockServiceAPI_ListServiceUsageAssets_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListServiceUsageAssets'

func (*MockServiceAPI_ListServiceUsageAssets_Call) Return

func (*MockServiceAPI_ListServiceUsageAssets_Call) Run

func (*MockServiceAPI_ListServiceUsageAssets_Call) RunAndReturn

type MockTypeGenerator

type MockTypeGenerator[T interface{}] struct {
	mock.Mock
}

MockTypeGenerator is an autogenerated mock type for the TypeGenerator type

func NewMockTypeGenerator

func NewMockTypeGenerator[T interface{}](t interface {
	mock.TestingT
	Cleanup(func())
}) *MockTypeGenerator[T]

NewMockTypeGenerator creates a new instance of MockTypeGenerator. 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 (*MockTypeGenerator[T]) EXPECT

func (_m *MockTypeGenerator[T]) EXPECT() *MockTypeGenerator_Expecter[T]

func (*MockTypeGenerator[T]) Execute

func (_m *MockTypeGenerator[T]) Execute(assets []*ExtendedGcpAsset, projectId string, projectName string, orgId string, orgName string) *T

Execute provides a mock function with given fields: assets, projectId, projectName, orgId, orgName

type MockTypeGenerator_Execute_Call

type MockTypeGenerator_Execute_Call[T interface{}] struct {
	*mock.Call
}

MockTypeGenerator_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'

func (*MockTypeGenerator_Execute_Call[T]) Return

func (*MockTypeGenerator_Execute_Call[T]) Run

func (_c *MockTypeGenerator_Execute_Call[T]) Run(run func(assets []*ExtendedGcpAsset, projectId string, projectName string, orgId string, orgName string)) *MockTypeGenerator_Execute_Call[T]

func (*MockTypeGenerator_Execute_Call[T]) RunAndReturn

type MockTypeGenerator_Expecter

type MockTypeGenerator_Expecter[T interface{}] struct {
	// contains filtered or unexported fields
}

func (*MockTypeGenerator_Expecter[T]) Execute

func (_e *MockTypeGenerator_Expecter[T]) Execute(assets interface{}, projectId interface{}, projectName interface{}, orgId interface{}, orgName interface{}) *MockTypeGenerator_Execute_Call[T]

Execute is a helper method to define mock.On call

  • assets []*ExtendedGcpAsset
  • projectId string
  • projectName string
  • orgId string
  • orgName string

type MonitoringAsset

type MonitoringAsset struct {
	CloudAccount *fetching.CloudAccountMetadata
	LogMetrics   []*ExtendedGcpAsset `json:"log_metrics,omitempty"`
	Alerts       []*ExtendedGcpAsset `json:"alerts,omitempty"`
}

type ProjectPoliciesAsset

type ProjectPoliciesAsset struct {
	CloudAccount *fetching.CloudAccountMetadata
	Policies     []*ExtendedGcpAsset `json:"policies,omitempty"`
}

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

func (*Provider) Close

func (p *Provider) Close() error

func (*Provider) ListAllAssetTypesByName

func (p *Provider) ListAllAssetTypesByName(ctx context.Context, assetTypes []string) ([]*ExtendedGcpAsset, error)

func (*Provider) ListLoggingAssets

func (p *Provider) ListLoggingAssets(ctx context.Context) ([]*LoggingAsset, error)

ListLoggingAssets returns a list of logging assets grouped by project id, extended with folder and org level log sinks

func (*Provider) ListMonitoringAssets

func (p *Provider) ListMonitoringAssets(ctx context.Context, monitoringAssetTypes map[string][]string) ([]*MonitoringAsset, error)

ListMonitoringAssets returns a list of monitoring assets grouped by project id

func (*Provider) ListProjectsAncestorsPolicies

func (p *Provider) ListProjectsAncestorsPolicies(ctx context.Context) ([]*ProjectPoliciesAsset, error)

func (*Provider) ListServiceUsageAssets

func (p *Provider) ListServiceUsageAssets(ctx context.Context) ([]*ServiceUsageAsset, error)

ListServiceUsageAssets returns a list of service usage assets grouped by project id

type ProviderInitializer

type ProviderInitializer struct{}

func (*ProviderInitializer) Init

type ProviderInitializerAPI

type ProviderInitializerAPI interface {
	// Init initializes the GCP asset client
	Init(ctx context.Context, log *logp.Logger, gcpConfig auth.GcpFactoryConfig) (ServiceAPI, error)
}

type ResourceManagerWrapper

type ResourceManagerWrapper struct {
	// contains filtered or unexported fields
}

type ServiceAPI

type ServiceAPI interface {
	// ListAllAssetTypesByName List all content types of the given assets types
	ListAllAssetTypesByName(ctx context.Context, assets []string) ([]*ExtendedGcpAsset, error)

	// ListMonitoringAssets List all monitoring assets by project id
	ListMonitoringAssets(ctx context.Context, monitoringAssetTypes map[string][]string) ([]*MonitoringAsset, error)

	// ListLoggingAssets returns a list of logging assets grouped by project id, extended with folder and org level log sinks
	ListLoggingAssets(ctx context.Context) ([]*LoggingAsset, error)

	// ListServiceUsageAssets returns a list of service usage assets grouped by project id
	ListServiceUsageAssets(ctx context.Context) ([]*ServiceUsageAsset, error)

	// returns a project policies for all its ancestors
	ListProjectsAncestorsPolicies(ctx context.Context) ([]*ProjectPoliciesAsset, error)

	// Close the GCP asset client
	Close() error
}

type ServiceUsageAsset

type ServiceUsageAsset struct {
	CloudAccount *fetching.CloudAccountMetadata
	Services     []*ExtendedGcpAsset `json:"services,omitempty"`
}

type TypeGenerator

type TypeGenerator[T any] func(assets []*ExtendedGcpAsset, projectId, projectName, orgId, orgName string) *T

Jump to

Keyboard shortcuts

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