Documentation ¶
Overview ¶
Package ram avoid code redundancy by grouping types and functions used by other ram packages
Index ¶
- Constants
- func BuildAncestorsDisplayName(ctx context.Context, ancestors []string, collectionID string, ...) []string
- func BuildAncestryPath(ancestors []string) string
- func CheckPath(path string)
- func Find(slice []string, val string) bool
- func GetAssetContact(contactRole string, resourceJSON json.RawMessage) (string, error)
- func GetByteSet(start byte, length int) []byte
- func GetChild(basePath string, relativeFolderPath string) []string
- func GetClientOptionAndCleanKeys(ctx context.Context, serviceAccountEmail string, keyJSONFilePath string, ...) (option.ClientOption, bool)
- func GetEnvVarBool(envVarName string) bool
- func GetEnvVarInt64(envVarName string) (int64, bool)
- func GetEnvVarTime(envVarName string) (time.Time, bool)
- func GetEnvVarUint64(envVarName string) (uint64, bool)
- func GetJWTConfigAndCleanKeys(ctx context.Context, serviceAccountEmail string, keyJSONFilePath string, ...) (jwtConfig *jwt.Config, err error)
- func GetPublishCallResult(ctx context.Context, publishResult *pubsub.PublishResult, ...)
- func IntialRetryCheck(ctxEvent context.Context, initFailed bool, retryTimeOutSeconds int64) (bool, *metadata.Metadata, error)
- func JSONMarshalIndentPrint(v interface{})
- func MarshalYAMLWrite(path string, v interface{}) (err error)
- func PrintEnptyInterfaceType(value interface{}, valueName string) error
- func ReadUnmarshalYAML(path string, settings interface{}) (err error)
- func ReadValidate(serviceName, settingsType, path string, settings interface{}) (err error)
- func RevertSlash(txt string) string
- func YAMLMarshalPrint(v interface{})
- func ZipSource(zipFullPath string, zipFiles map[string]string) (err error)
- type AssetGroup
- type AssetGroupSettings
- type AssetMember
- type ComplianceStatus
- type FeedMessageGroup
- type FeedMessageGroupSettings
- type FeedMessageMember
- type GCSEvent
- type Member
- type PubSubMessage
- type PublishRequest
- type Window
Constants ¶
const ( DevelopmentEnvironmentName = "dev" SettingsFileName = "settings.yaml" SolutionSettingsFileName = "solution.yaml" ServiceSettingsFileName = "service.yaml" InstanceSettingsFileName = "instance.yaml" MicroserviceParentFolderName = "services" InstancesFolderName = "instances" RegoConstraintsFolderName = "constraints" SolutionName = "ram" )
Settings file names
const YAMLDisclaimer = `` /* 577-byte string literal not displayed */
YAMLDisclaimer text to be added on top of yaml files
Variables ¶
This section is empty.
Functions ¶
func BuildAncestorsDisplayName ¶
func BuildAncestorsDisplayName(ctx context.Context, ancestors []string, collectionID string, firestoreClient *firestore.Client, cloudresourcemanagerService *cloudresourcemanager.Service, cloudresourcemanagerServiceV2 *cloudresourcemanagerv2.Service) []string
BuildAncestorsDisplayName build a slice of Ancestor friendly name from a slice of ancestors
func BuildAncestryPath ¶
BuildAncestryPath build a path from a slice of ancestors
func CheckPath ¶ added in v0.0.24
func CheckPath(path string)
CheckPath crashes execution when the path is not found or when an other error occurs
func GetAssetContact ¶
func GetAssetContact(contactRole string, resourceJSON json.RawMessage) (string, error)
GetAssetContact retrieve owner of resolver contact from asset labels and parent labels
func GetByteSet ¶
GetByteSet return a set of lenght contiguous bytes starting at bytes
func GetChild ¶ added in v0.0.24
GetChild returns the list to relative subfolders path for a folder + a relative path, crashes execution on errors
func GetClientOptionAndCleanKeys ¶
func GetClientOptionAndCleanKeys(ctx context.Context, serviceAccountEmail string, keyJSONFilePath string, projectID string, gciAdminUserToImpersonate string, scopes []string) (option.ClientOption, bool)
GetClientOptionAndCleanKeys build a clientOption object and manage the init state
func GetEnvVarBool ¶ added in v0.0.24
GetEnvVarBool retreive an os var, and convert it to bool
func GetEnvVarInt64 ¶
GetEnvVarInt64 retreive an os var, convert it and manage the init state
func GetEnvVarTime ¶
GetEnvVarTime retreive an os var, convert it and manage the init state
func GetEnvVarUint64 ¶
GetEnvVarUint64 retreive an os var, convert it and manage the init state
func GetJWTConfigAndCleanKeys ¶ added in v0.0.24
func GetJWTConfigAndCleanKeys(ctx context.Context, serviceAccountEmail string, keyJSONFilePath string, projectID string, gciAdminUserToImpersonate string, scopes []string) (jwtConfig *jwt.Config, err error)
GetJWTConfigAndCleanKeys build a JWT config and manage the init state
func GetPublishCallResult ¶
func GetPublishCallResult(ctx context.Context, publishResult *pubsub.PublishResult, waitgroup *sync.WaitGroup, msgInfo string, pubSubErrNumber *uint64, pubSubMsgNumber *uint64, logEventEveryXPubSubMsg uint64)
GetPublishCallResult func to be used in go routine to scale pubsub event publish
func IntialRetryCheck ¶
func IntialRetryCheck(ctxEvent context.Context, initFailed bool, retryTimeOutSeconds int64) (bool, *metadata.Metadata, error)
IntialRetryCheck performs intitial controls 1) return true and metadata when controls are passed 2) return false when controls failed: - 2a) with an error to retry the cloud function entry point function - 2b) with nil to stop the cloud function entry point function
func JSONMarshalIndentPrint ¶ added in v0.0.24
func JSONMarshalIndentPrint(v interface{})
JSONMarshalIndentPrint marshal with 4 spaces indent no prefix and fmt print
func MarshalYAMLWrite ¶ added in v0.0.24
MarshalYAMLWrite Marshal an interface to YAML format and write the bytes to a given path
func PrintEnptyInterfaceType ¶
PrintEnptyInterfaceType discover the type below an empty interface
func ReadUnmarshalYAML ¶ added in v0.0.24
ReadUnmarshalYAML Read bytes from a given path and unmarshal assuming YAML format
func ReadValidate ¶ added in v0.0.24
ReadValidate reads a YAML config file to a struct and validate the struct
func YAMLMarshalPrint ¶ added in v0.0.24
func YAMLMarshalPrint(v interface{})
YAMLMarshalPrint marshal from YAML and fmt print
Types ¶
type AssetGroup ¶
type AssetGroup struct { Name string `json:"name"` AssetType string `json:"assetType"` Ancestors []string `json:"ancestors"` AncestryPath string `json:"ancestryPath"` IamPolicy json.RawMessage `json:"iamPolicy"` Resource *admin.Group `json:"resource"` }
AssetGroup CAI like format
type AssetGroupSettings ¶
type AssetGroupSettings struct { Name string `json:"name"` AssetType string `json:"assetType"` Ancestors []string `json:"ancestors"` IamPolicy json.RawMessage `json:"iamPolicy"` Resource *groupssettings.Groups `json:"resource"` }
AssetGroupSettings CAI like format
type AssetMember ¶
type AssetMember struct { Name string `json:"name"` AssetType string `json:"assetType"` Ancestors []string `json:"ancestors"` AncestryPath string `json:"ancestryPath"` IamPolicy json.RawMessage `json:"iamPolicy"` Resource Member `json:"resource"` }
AssetMember CAI like format
type ComplianceStatus ¶ added in v0.0.14
type ComplianceStatus struct { AssetName string `json:"assetName"` AssetInventoryTimeStamp time.Time `json:"assetInventoryTimeStamp"` AssetInventoryOrigin string `json:"assetInventoryOrigin"` RuleName string `json:"ruleName"` RuleDeploymentTimeStamp time.Time `json:"ruleDeploymentTimeStamp"` Compliant bool `json:"compliant"` Deleted bool `json:"deleted"` }
ComplianceStatus by asset, by rule, true/false compliance status
type FeedMessageGroup ¶
type FeedMessageGroup struct { Asset AssetGroup `json:"asset"` Window Window `json:"window"` Deleted bool `json:"deleted"` Origin string `json:"origin"` }
FeedMessageGroup CAI like format
type FeedMessageGroupSettings ¶
type FeedMessageGroupSettings struct { Asset AssetGroupSettings `json:"asset"` Window Window `json:"window"` Deleted bool `json:"deleted"` Origin string `json:"origin"` }
FeedMessageGroupSettings CAI like format
type FeedMessageMember ¶
type FeedMessageMember struct { Asset AssetMember `json:"asset"` Window Window `json:"window"` Deleted bool `json:"deleted"` Origin string `json:"origin"` }
FeedMessageMember CAI like format
type GCSEvent ¶
type GCSEvent struct { Kind string `json:"kind"` ID string `json:"id"` SelfLink string `json:"selfLink"` Name string `json:"name"` Bucket string `json:"bucket"` Generation string `json:"generation"` Metageneration string `json:"metageneration"` ContentType string `json:"contentType"` TimeCreated time.Time `json:"timeCreated"` Updated time.Time `json:"updated"` TemporaryHold bool `json:"temporaryHold"` EventBasedHold bool `json:"eventBasedHold"` RetentionExpirationTime time.Time `json:"retentionExpirationTime"` StorageClass string `json:"storageClass"` TimeStorageClassUpdated time.Time `json:"timeStorageClassUpdated"` Size string `json:"size"` MD5Hash string `json:"md5Hash"` MediaLink string `json:"mediaLink"` ContentEncoding string `json:"contentEncoding"` ContentDisposition string `json:"contentDisposition"` CacheControl string `json:"cacheControl"` Metadata map[string]interface{} `json:"metadata"` CRC32C string `json:"crc32c"` ComponentCount int `json:"componentCount"` Etag string `json:"etag"` CustomerEncryption struct { EncryptionAlgorithm string `json:"encryptionAlgorithm"` KeySha256 string `json:"keySha256"` } KMSKeyName string `json:"kmsKeyName"` ResourceState string `json:"resourceState"` }
GCSEvent is the payload of a GCS event.
type Member ¶
type Member struct { MemberEmail string `json:"memberEmail"` GroupEmail string `json:"groupEmail"` ID string `json:"id"` Kind string `json:"kind"` Role string `json:"role"` Type string `json:"type"` }
Member is sligthly different from admim.Member to have both group email and member email
type PubSubMessage ¶
type PubSubMessage struct {
Data []byte `json:"data"`
}
PubSubMessage is the payload of a Pub/Sub event.
type PublishRequest ¶
type PublishRequest struct {
Topic string `json:"topic"`
}
PublishRequest Pub/sub