utils

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TEXT    format = "text"
	JSON    format = "json"
	UNKNOWN format = "unknown"
)
View Source
const (
	SAPBTPOperatorSecretName    = "sap-btp-service-operator"
	SAPBTPOperatorTLSSecretName = "sap-btp-service-operator-tls"
)

Variables

This section is empty.

Functions

func BuildSMRequestParameters

func BuildSMRequestParameters(kubeClient client.Client, namespace string, parametersFrom []servicesv1.ParametersFromSource, parameters *runtime.RawExtension) (map[string]interface{}, []byte, error)

buildParameters generates the parameters JSON structure to be passed to the broker. The first return value is a map of parameters to send to the Broker, including secret values. The second return value is parameters marshalled to byt array The third return value is any error that caused the function to fail.

func BuildUserInfo

func BuildUserInfo(ctx context.Context, userInfo *v1.UserInfo) string

func GetLogger

func GetLogger(ctx context.Context) logr.Logger

func GetSMClient

func GetSMClient(ctx context.Context, secretResolver *SecretResolver, resourceNamespace, btpAccessSecretName string) (sm.Client, error)

func HandleError

func HandleError(ctx context.Context, k8sClient client.Client, operationType smClientTypes.OperationCategory, err error, resource common.SAPBTPResource, ignoreNonTransient bool) (ctrl.Result, error)

func InitConditions

func InitConditions(ctx context.Context, k8sClient client.Client, obj common.SAPBTPResource) error

func IsFailed

func IsFailed(resource common.SAPBTPResource) bool

func IsInProgress

func IsInProgress(object common.SAPBTPResource) bool

func IsMarkedForDeletion

func IsMarkedForDeletion(object metav1.ObjectMeta) bool

func IsTransientError

func IsTransientError(smError *sm.ServiceManagerError, log logr.Logger) bool

func MarkAsNonTransientError

func MarkAsNonTransientError(ctx context.Context, k8sClient client.Client, operationType smClientTypes.OperationCategory, errMsg string, object common.SAPBTPResource) (ctrl.Result, error)

func MarkAsTransientError

func MarkAsTransientError(ctx context.Context, k8sClient client.Client, operationType smClientTypes.OperationCategory, err error, object common.SAPBTPResource) (ctrl.Result, error)

func MarshalRawParameters

func MarshalRawParameters(in map[string]interface{}) ([]byte, error)

MarshalRawParameters marshals the specified map of parameters into JSON

func RandStringRunes

func RandStringRunes(n int) string

func RemoveAnnotations

func RemoveAnnotations(ctx context.Context, k8sClient client.Client, object common.SAPBTPResource, keys ...string) error

func RemoveFinalizer

func RemoveFinalizer(ctx context.Context, k8sClient client.Client, object common.SAPBTPResource, finalizerName string) error

func SetBlockedCondition

func SetBlockedCondition(ctx context.Context, message string, object common.SAPBTPResource)

blocked condition marks to the user that action from his side is required, this is considered as in progress operation

func SetCredRotationInProgressConditions

func SetCredRotationInProgressConditions(reason, message string, object common.SAPBTPResource)

func SetFailureConditions

func SetFailureConditions(operationType smClientTypes.OperationCategory, errorMessage string, object common.SAPBTPResource)

func SetInProgressConditions

func SetInProgressConditions(ctx context.Context, operationType smClientTypes.OperationCategory, message string, object common.SAPBTPResource)

func SetSuccessConditions

func SetSuccessConditions(operationType smClientTypes.OperationCategory, object common.SAPBTPResource)

func SliceContains

func SliceContains(slice []string, i string) bool

func UnmarshalRawParameters

func UnmarshalRawParameters(in []byte) (map[string]interface{}, error)

UnmarshalRawParameters produces a map structure from a given raw YAML/JSON input

func UpdateStatus

func UpdateStatus(ctx context.Context, k8sClient client.Client, object common.SAPBTPResource) error

Types

type LogKey

type LogKey struct {
}

type SecretMetadataProperty

type SecretMetadataProperty struct {
	Name      string `json:"name"`
	Container bool   `json:"container,omitempty"`
	Format    string `json:"format"`
}

func NormalizeCredentials

func NormalizeCredentials(credentialsJSON json.RawMessage) (map[string][]byte, []SecretMetadataProperty, error)

type SecretResolver

type SecretResolver struct {
	ManagementNamespace    string
	ReleaseNamespace       string
	EnableNamespaceSecrets bool
	Client                 client.Client
	Log                    logr.Logger
}

func (*SecretResolver) GetSecretForResource

func (sr *SecretResolver) GetSecretForResource(ctx context.Context, namespace, name string) (*v1.Secret, error)

func (*SecretResolver) GetSecretFromManagementNamespace

func (sr *SecretResolver) GetSecretFromManagementNamespace(ctx context.Context, name string) (*v1.Secret, error)

Jump to

Keyboard shortcuts

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