utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CatalogConnectorServiceAddressKey   string = "CATALOG_CONNECTOR_URL"
	CredentialsManagerServiceAddressKey string = "CREDENTIALS_CONNECTOR_URL"
	VaultAddressKey                     string = "VAULT_ADDRESS"
	VaultSecretKey                      string = "VAULT_TOKEN"
	VaultDatasetMountKey                string = "VAULT_DATASET_MOUNT"
	VaultDatasetHomeKey                 string = "VAULT_DATASET_HOME"
	VaultTTLKey                         string = "VAULT_TTL"
	VaultModulesRole                    string = "VAULT_MODULES_ROLE"
)

Attributes that are defined in a config map or the runtime environment

Variables

This section is empty.

Functions

func CreateDataSetIdentifier

func CreateDataSetIdentifier(datasetID string) string

CreateDataSetIdentifier constructs an identifier for a dataset For a JSON string, a concatenation of values is used when keys are sorted alphabetically

func CreateUnstructured

func CreateUnstructured(group, version, kind, name, namespace string) *unstructured.Unstructured

CreateUnstructured creates a new Unstructured runtime object

func DefaultTestConfiguration

func DefaultTestConfiguration(t ginkgo.GinkgoTInterface)

func GetAttribute

func GetAttribute(attribute string, jsonStr string) string

GetAttribute parses a JSON string and returns the required attribute value

func GetAuthPath

func GetAuthPath(authPath string) string

GetAuthPath returns the auth method path to use It is of the form v1/auth/<auth path>/login

func GetCredentialsManagerServiceAddress

func GetCredentialsManagerServiceAddress() string

GetCredentialsManagerServiceAddress returns the address where credentials manager is running

func GetDataCatalogServiceAddress

func GetDataCatalogServiceAddress() string

GetDataCatalogServiceAddress returns the address where data catalog is running

func GetDataFormat

func GetDataFormat(info *dc.DatasetDetails) (app.DataFormatType, error)

GetDataFormat returns the existing data format

func GetModulesRole

func GetModulesRole() string

GetModulesRole returns the modules assigned authentification role for accessing dataset credentials

func GetProtocol

func GetProtocol(info *dc.DatasetDetails) (app.IFProtocol, error)

GetProtocol returns the existing data protocol

func GetSecretPath

func GetSecretPath(assetID string) string

GetSecretPath returns the path to the secret that holds the dataset's credentials It is of the form /v1/m4d-system/dataset-creds/...

func GetSystemNamespace

func GetSystemNamespace() string

GetSystemNamespace returns the namespace of control plane

func GetVaultAddress

func GetVaultAddress() string

GetVaultAddress returns the address and port of the vault system, which is used for managing data set credentials

func GetVaultAuthTTL

func GetVaultAuthTTL() string

GetVaultAuthTTL returns the amount of time the authorization issued by vault is valid

func GetVaultDatasetHome

func GetVaultDatasetHome() string

GetVaultDatasetHome returns the home directory in vault of where dataset credentials are stored. All credentials will be in sub-directories of this directory in the form of catalog_id/dataset_id

func GetVaultDatasetMountPath

func GetVaultDatasetMountPath() string

GetVaultDatasetMountPath returns the mount directory in vault of where dataset credentials are stored. All credentials will be in sub-directories of this directory in the form of catalog_id/dataset_id

func GetVaultToken

func GetVaultToken() string

GetVaultToken returns the token this module uses to authenticate with vault

func Hash

func Hash(value string, hashLength int) string

Hash generates a name based on the unique identifier

func HelmConformName

func HelmConformName(name string) string

Helm has stricter restrictions than K8s and restricts release names to 53 characters

func IsAction

func IsAction(actionName string) bool

IsAction returns true if any action is required

func IsDenied

func IsDenied(actionName string) bool

IsDenied returns true if the data access is denied

func IsTransformation

func IsTransformation(actionName string) bool

IsTransformation returns true if the data transformation is required

func K8sConformName

func K8sConformName(name string) string

Some k8s objects only allow for a length of 63 characters. This method shortens the name keeping a prefix and using the last 5 characters of the new name for the hash of the postfix.

func ListeningAddress

func ListeningAddress(port int) string

func PrintStructure

func PrintStructure(argStruct interface{}, log logr.Logger, argName string)

PrintStructure prints the structure in a textual format

func SetIfNotSet

func SetIfNotSet(key string, value string, t ginkgo.GinkgoTInterface)

func ShortenedName

func ShortenedName(name string, maxLength int, hashLength int) string

This function shortens a name to the maximum length given and uses rest of the string that is too long as hash that gets added to the valid name.

func StructToMap

func StructToMap(data interface{}) (map[string]interface{}, error)

StructToMap converts a struct to a map using JSON marshal

func SupportsFlow

func SupportsFlow(array []app.ModuleFlow, element app.ModuleFlow) bool

SupportsFlow checks whether the given flow element can be found inside the array of flows

func SupportsInterface

func SupportsInterface(array []*app.InterfaceDetails, element *app.InterfaceDetails) bool

SupportsInterface returns true iff the protocol/format list contains the given protocol/format interface

Types

type UnstructuredAsLabels

type UnstructuredAsLabels struct {
	Data *unstructured.Unstructured
}

UnstructuredAsLabels is an implementation of labels.Labels interface which allows us to take advantage of k8s labels library for the purposes of evaluating fail and success conditions

func (UnstructuredAsLabels) Get

func (c UnstructuredAsLabels) Get(label string) string

Get returns the value for the provided label.

func (UnstructuredAsLabels) Has

func (c UnstructuredAsLabels) Has(label string) bool

Has returns whether the provided label exists.

Jump to

Keyboard shortcuts

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