utils

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: Apache-2.0 Imports: 26 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(namespace string, parametersFrom []servicesv1.ParametersFromSource, parameters *runtime.RawExtension) (map[string]interface{}, []byte, error)

BuildSMRequestParameters 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, serviceInstance *v1.ServiceInstance) (sm.Client, error)

func GetSecretForResource added in v0.6.6

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

func GetSecretFromManagementNamespace added in v0.6.6

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

func GetSecretWithFallback added in v0.6.6

func GetSecretWithFallback(ctx context.Context, namespacedName types.NamespacedName, secret *v1.Secret) error

func HandleDeleteError added in v0.6.9

func HandleDeleteError(ctx context.Context, k8sClient client.Client, err error, object common.SAPBTPResource) (ctrl.Result, error)

func HandleError

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

func InitConditions

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

func InitializeSecretsClient added in v0.6.6

func InitializeSecretsClient(client, nonCachedClient client.Client, config config.Config)

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, err error, 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, isAsyncOperation bool)

func SetInProgressConditions

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

func SetSuccessConditions

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

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

type InvalidCredentialsError struct{}

func (*InvalidCredentialsError) Error added in v0.6.7

func (ic *InvalidCredentialsError) Error() string

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)

Jump to

Keyboard shortcuts

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