fetchrules

package module
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

README

fetchrules

pipeline status coverage
Fetch the compliance rules related to the asset type

Prerequsites

Manual task:

  • From Firestore console, select native mode and the multi-region location of your choice (e.g. eur3)

For running integration test in the DEV environment:

  • roles/datastore.user instead of roles/datastore.viewer

Documentation

Overview

Package fetchrules in the fetchrules go module is a function based on the function framework to fetch compliance rules related to the asset type

Triggered by

A cloud event containing one asset config (the feed message)

Output

- Cloud Events on PubSub assetRule topic.

Cardinality

- n Cloud Events on PubSub assetRule topic. n = the number of matching rules

Automatic retrying

Yes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeployRules

func DeployRules(ctx context.Context,
	rulesFolderPath string,
	onlyType string,
	rulesRepoBucketName string,
	projectID string,
	logOnlySeverityLevels string,
	redeploy bool,
	location string) (err error)

DeployRules read rule files packages them an deploy to firestore collection

func EntryPoint

func EntryPoint(ctxEvent context.Context, pubsubMsg pubsub.Message) error

EntryPoint function entry point.

Types

type ConstraintConfigs

type ConstraintConfigs map[string]cai.ConstraintConfig

ConstraintConfigs map key is the constraint name

type ContentOrAssetTypeConfigs

type ContentOrAssetTypeConfigs map[string]RuleConfigs

ContentOrAssetTypeConfigs map key is the ContentType or the AssetType

type Env

type Env struct {
	KConfiguration string `envconfig:"k_configuration"`
	KRevision      string `envconfig:"k_revision"`
	KService       string `envconfig:"k_service"`
}

Env list environment variables

type Global

type Global struct {
	CommonEv glo.CommonEntryValues
	// contains filtered or unexported fields
}

Global structure for global variables to optimize the performances in serverless mode

type RuleConfig

type RuleConfig struct {
	RegoCode          string            `json:"regoCode"`
	Version           time.Time         `json:"version"`
	ConstraintConfigs ConstraintConfigs `json:"constraintConfigs"`
}

RuleConfig one rego rule and associated constraint configs

type RuleConfigs

type RuleConfigs map[string]*RuleConfig

RuleConfigs map key is the rule name aka the kind

type RulesRepo

type RulesRepo struct {
	Version                   time.Time                 `json:"version"`
	ContentOrAssetTypeConfigs ContentOrAssetTypeConfigs `json:"contentOrAssetTypeConfigs"`
}

RulesRepo repository of rules by ContentOrAssetType / rule kind / constraint name

type ServiceEnv

type ServiceEnv struct {
	AssetRuleTopicID      string  `envconfig:"asset_rule_topic_id" default:"assetRule"`
	CacheMaxAgeMinutes    float64 `envconfig:"cache_max_age_minutes" default:"60"`
	Environment           string  `envconfig:"environment" default:"dev"`
	LogOnlySeveritylevels string  `envconfig:"log_only_severity_levels" default:"WARNING NOTICE CRITICAL"`
	ProjectID             string  `envconfig:"project_id" required:"true"`
	RulesRepoBucketName   string  `envconfig:"rules_repo_bucket_name"`
	StartProfiler         bool    `envconfig:"start_profiler" default:"false"`
}

ServiceEnv list environment variables prefixed with the name of the microservice

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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