helper

package
v0.0.9-rc8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAncestorsDisplayName added in v0.0.2

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 added in v0.0.2

func BuildAncestryPath(ancestors []string) string

BuildAncestryPath build a path from a slice of ancestors

func CreateTopic added in v0.0.2

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 added in v0.0.2

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

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

func GetAssetContact added in v0.0.2

func GetAssetContact(contactRole string, resourceJSON json.RawMessage) (string, error)

GetAssetContact retrieve owner of resolver contact from asset labels and parent labels

func GetByteSet added in v0.0.8

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 GetEnvVarUint64

func GetEnvVarUint64(envVarName string) (uint64, bool)

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

func GetPublishCallResult added in v0.0.8

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 added in v0.0.2

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 added in v0.0.2

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 PubSubMessage added in v0.0.3

type PubSubMessage struct {
	Data []byte `json:"data"`
}

PubSubMessage is the payload of a Pub/Sub event.

type PublishRequest added in v0.0.2

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