postgresql

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgreSQL

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

PostgreSQL abstracts management of PostgreSQL client.

func NewPostgreSQL

func NewPostgreSQL(ctx context.Context, databaseURL string) (*PostgreSQL, error)

NewPostgreSQL creates a new instance of PostgreSQL object.

func (*PostgreSQL) DeleteAllComplianceRows

func (p *PostgreSQL) DeleteAllComplianceRows(ctx context.Context, schema string, tableName string, leafHubName string,
	policyID string,
) error

DeleteAllComplianceRows delete all compliance rows from the db by leaf hub and policy.

func (*PostgreSQL) GetComplianceStatusByLeafHub

func (p *PostgreSQL) GetComplianceStatusByLeafHub(ctx context.Context, schema string, tableName string,
	leafHubName string,
) (map[string]*db.PolicyClustersSets, error)

GetComplianceStatusByLeafHub returns a map of policies, each maps to a set of clusters.

func (*PostgreSQL) GetLocalResourceIDToVersionByLeafHub

func (p *PostgreSQL) GetLocalResourceIDToVersionByLeafHub(ctx context.Context, schema string, tableName string,
	leafHubName string,
) (map[string]string, error)

GetLocalResourceIDToVersionByLeafHub returns a map from resource id to its resourceVersion.

func (*PostgreSQL) GetManagedClustersByLeafHub

func (p *PostgreSQL) GetManagedClustersByLeafHub(ctx context.Context, schema string, tableName string,
	leafHubName string,
) (map[string]string, error)

GetManagedClustersByLeafHub returns list of managed clusters and for each managed cluster it's resourceVersion.

func (*PostgreSQL) GetNonCompliantClustersByLeafHub

func (p *PostgreSQL) GetNonCompliantClustersByLeafHub(ctx context.Context, schema string, tableName string,
	leafHubName string,
) (map[string]*db.PolicyClustersSets, error)

GetNonCompliantClustersByLeafHub returns a map of policies, each maps to sets of (NonCompliant,Unknown) clusters.

func (*PostgreSQL) GetPolicyIDsByLeafHub

func (p *PostgreSQL) GetPolicyIDsByLeafHub(ctx context.Context, schema string, tableName string,
	leafHubName string,
) (set.Set, error)

GetPolicyIDsByLeafHub returns policy IDs of a specific leaf hub.

func (*PostgreSQL) GetPoolSize

func (p *PostgreSQL) GetPoolSize() int32

GetPoolSize returns the max number of connections.

func (*PostgreSQL) GetResourceIDToVersionByLeafHub

func (p *PostgreSQL) GetResourceIDToVersionByLeafHub(ctx context.Context, schema string, tableName string,
	leafHubName string,
) (map[string]string, error)

GetResourceIDToVersionByLeafHub returns a map from resource id to its resourceVersion.

func (*PostgreSQL) InsertOrUpdateAggregatedPolicyCompliance

func (p *PostgreSQL) InsertOrUpdateAggregatedPolicyCompliance(ctx context.Context, schema string, tableName string,
	leafHubName string, policyID string, appliedClusters int, nonCompliantClusters int,
) error

InsertOrUpdateAggregatedPolicyCompliance inserts or updates aggregated policy compliance row in the db.

func (*PostgreSQL) NewGenericBatchBuilder

func (p *PostgreSQL) NewGenericBatchBuilder(schema string, tableName string,
	leafHubName string,
) db.GenericBatchBuilder

NewGenericBatchBuilder creates a new instance of GenericBatchBuilder.

func (*PostgreSQL) NewGenericLocalBatchBuilder

func (p *PostgreSQL) NewGenericLocalBatchBuilder(schema string, tableName string,
	leafHubName string,
) db.GenericLocalBatchBuilder

NewGenericLocalBatchBuilder creates a new instance of GenericLocalBatchBuilder.

func (*PostgreSQL) NewManagedClustersBatchBuilder

func (p *PostgreSQL) NewManagedClustersBatchBuilder(schema string, tableName string,
	leafHubName string,
) db.ManagedClustersBatchBuilder

NewManagedClustersBatchBuilder creates a new instance of ManagedClustersBatchBuilder.

func (*PostgreSQL) NewPoliciesBatchBuilder

func (p *PostgreSQL) NewPoliciesBatchBuilder(schema string, tableName string,
	leafHubName string,
) db.PoliciesBatchBuilder

NewPoliciesBatchBuilder creates a new instance of PoliciesBatchBuilder.

func (*PostgreSQL) SendBatch

func (p *PostgreSQL) SendBatch(ctx context.Context, batch interface{}) error

SendBatch sends a batch operation to the db and returns list of errors if there were any.

func (*PostgreSQL) Stop

func (p *PostgreSQL) Stop()

Stop function stops PostgreSQL client.

func (*PostgreSQL) UpdateHeartbeat

func (p *PostgreSQL) UpdateHeartbeat(ctx context.Context, schema string, tableName string, leafHubName string) error

UpdateHeartbeat inserts or updates heartbeat for a leaf hub.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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