helpers

package
v0.48.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Overview

Package helpers implements the helpers.

Package helpers is containing the logic which can be used to connect to BigQuery and run some request to audit log.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BqClient added in v0.24.0

func BqClient(ctx context.Context) (*bigquery.Client, error)

BqClient creates a client connection to BigQuery.

Types

type Client

type Client struct {

	// The gRPC API client.
	ClientKnowledge *knowledge.Client
	// The second gRPC API client.
	ClientIngest *ingest.Client

	ClientConfig         *config.Client
	ClientEntitymatching *entitymatching.Client
	// contains filtered or unexported fields
}

func (*Client) Close

func (c *Client) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*Client) CreateAndRunEntityMatching added in v0.41.0

func (c *Client) CreateAndRunEntityMatching(
	location string,
	name string,
	configuration *configpb.EntityMatchingPipelineConfig,
	similarityScoreCutoff float32,
) (*CreateAndRun, error)

func (*Client) DeleteNodes added in v0.22.0

func (c *Client) DeleteNodes(
	ctx context.Context,
	nodeType string,
) ([]*ingestpb.StreamRecordsResponse,
	error)

DeleteNodes is a helper function that delete all nodes of specific type either Identities or Resource and return array of StreamRecordsResponse.

type CreateAndRun added in v0.41.0

type CreateAndRun struct {
	ConfigNodeID string
}

type FilterFields added in v0.24.0

type FilterFields struct {
	AppSpaceID         string
	AppSpaceIDConfig   string
	AuditLogIdentifier string
	ChangeType         string
	EventSource        string
	EventType          string
	RowNumber          string
}

FilterFields is a collection of variable to set up the actual query more easily.

func FillFilterFieldsFromEnvironment added in v0.24.0

func FillFilterFieldsFromEnvironment() (FilterFields, error)

FillFilterFieldsFromEnvironment creates a FilterFields object and prefills the App space information from the App credential environment variable.

type ReturnValues added in v0.24.0

type ReturnValues struct {
	PublishTime time.Time `bigquery:"publish_time"`
	Data        string    `bigquery:"data"`
}

ReturnValues maps the response from bigquery. The getReturnFields specifies what to expect from bigquery and all of those fields should be represented here.

func QueryAuditLog added in v0.24.0

func QueryAuditLog(ctx context.Context, client *bigquery.Client, fFields *FilterFields) (ReturnValues, error)

QueryAuditLog sends a query request to the BigQuery with the given parameters and returns with its result It returns with error if the RUN_ENV environment variable is not set or not develop/staging.

Jump to

Keyboard shortcuts

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