utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

  • Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. *

  • This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.

  • Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. *

  • This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.

  • Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. *

  • This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.

  • Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. *

  • This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.

Package utils contains various utility functions to use in other packages

  • Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. *

  • This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.

  • Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. *

  • This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.

  • Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. *

  • This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.

  • Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. *

  • This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.

  • Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. *

  • This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdjustNumWorkers

func AdjustNumWorkers(workers int) int

func Contains

func Contains(target, list interface{}) bool

Contains if a function to check if list contains target

func ContainsInString

func ContainsInString(target string, list []string) bool

ContainsInString verifies if some string in list contains the specified target

func DecryptAnsibleVault

func DecryptAnsibleVault(ctx context.Context, fileContent []byte, secret string) []byte

DecryptAnsibleVault verifies if the fileContent is encrypted by ansible-vault. If yes, the function decrypts it

func GetExtension

func GetExtension(ctx context.Context, path string) (string, error)

GetExtension gets the extension of a file path

func GetVaultPassword added in v0.0.9

func GetVaultPassword() string

GetVaultPassword returns the vault password read from ANSIBLE_VAULT_PASSWORD_FILE, cached after the first call.

func HandlePanic

func HandlePanic(ctx context.Context, r any, errMessage string)

func IsAnsibleVaultEncrypted added in v0.0.9

func IsAnsibleVaultEncrypted(content []byte) bool

IsAnsibleVaultEncrypted reports whether content is Ansible Vault encrypted.

func LineCounter

func LineCounter(ctx context.Context, path string) (int, error)

LineCounter get the number of lines of a given file

func MergeMaps

func MergeMaps(map1, map2 map[string]interface{})

MergeMaps merges two maps

func NextRandom

func NextRandom() string

NextRandom returns a random number

func NormalizeAnsibleResourceType added in v0.0.5

func NormalizeAnsibleResourceType(resourceType string) string

NormalizeAnsibleResourceType returns the Ansible content name (last segment after ".") from a fully qualified collection name (FQCN) or short name. Used so that rego rules can output either "community.aws.ec2_instance" or "ec2_instance" and we consistently expose "ec2_instance". If resourceType has no ".", it is returned unchanged.

func ReadVaultPassword added in v0.0.9

func ReadVaultPassword(filePath string) string

ReadVaultPassword reads the vault password from the file at filePath.

func SplitLines

func SplitLines(content string) *[]string

SplitLines splits the document by line

Types

This section is empty.

Jump to

Keyboard shortcuts

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