ram

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package ram avoid code redundancy by grouping types and functions used by other ram packages

Index

Constants

This section is empty.

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 fron a slice of ancestors

func BuildAncestryPath

func BuildAncestryPath(ancestors []string) string

BuildAncestryPath build a path from a slice of ancestors

func CreateTopic

func CreateTopic(ctx context.Context, pubSubClient *pubsub.Client, topicList []string, topicName string) error

CreateTopic check if a topic already exist, if not create it

func Find

func Find(slice []string, val string) bool

Find a string in a slice of string. Return true when found else false

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

func GetByteSet(start byte, length int) []byte

GetByteSet return a set of lenght contiguous bytes starting at bytes

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 GetEnvVarInt64

func GetEnvVarInt64(envVarName string) (int64, bool)

GetEnvVarInt64 retreive an os var, convert it and manage the init state

func GetEnvVarTime

func GetEnvVarTime(envVarName string) (time.Time, bool)

GetEnvVarTime retreive an os var, convert it and manage the init state

func GetEnvVarUint64

func GetEnvVarUint64(envVarName string) (uint64, bool)

GetEnvVarUint64 retreive an os var, convert it 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 GetTopicList

func GetTopicList(ctx context.Context, pubSubClient *pubsub.Client) ([]string, error)

GetTopicList retreive the list of existing pubsub topics

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 PrintEnptyInterfaceType

func PrintEnptyInterfaceType(value interface{}, valueName string) error

PrintEnptyInterfaceType discover the type below an empty interface

func RevertSlash

func RevertSlash(txt string) string

RevertSlash replace slash / by back slash \

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

type Window

type Window struct {
	StartTime time.Time `json:"startTime" firestore:"startTime"`
}

Window Cloud Asset Inventory feed message time window

Jump to

Keyboard shortcuts

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