helpers

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

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
	// 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) 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 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