util

package
v0.11.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Step          = "step"
	Name          = "name"
	Namespace     = "namespace"
	Kind          = "kind"
	DependentName = "dependentName"
	DependentKind = "dependentKind"
)
View Source
const (
	AnnotationPrimaryXSUAA = "sme.sap.com/primary-xsuaa"
)
View Source
const LabelBTPApplicationIdentifierHash = "sme.sap.com/btp-app-identifier-hash"

Variables

This section is empty.

Functions

func CreateVCAPEntryFromSecret

func CreateVCAPEntryFromSecret(serviceInfo *v1alpha1.ServiceInfo, ns string, kubeClient kubernetes.Interface) (entry map[string]any, err error)

func GetConfig

func GetConfig() *rest.Config

func GetLogger added in v0.5.0

func GetLogger() logr.Logger

func GetNamespace

func GetNamespace() string

func GetXSUAAInfo

func GetXSUAAInfo(consumedServiceInfos []v1alpha1.ServiceInfo, ca *v1alpha1.CAPApplication) *v1alpha1.ServiceInfo

func InitMetricsServer added in v0.11.0

func InitMetricsServer()

Initializes the metrics server with default port 9090 and path /metrics based on default prometheus client

func InstrumentHttpHandler added in v0.11.0

func InstrumentHttpHandler(handler func(http.ResponseWriter, *http.Request), metricNamePrefix string, helpTextSuffix string) http.HandlerFunc

Instruments the given HTTP handler with counter (total requests) and gauge (in flight requests) metrics

func LogError added in v0.7.0

func LogError(error error, msg string, step string, entity interface{}, child interface{}, args ...interface{})

func LogInfo added in v0.7.0

func LogInfo(msg string, step string, entity interface{}, child interface{}, args ...interface{})

func LogWarning added in v0.10.0

func LogWarning(args ...interface{})

func ParseJSON

func ParseJSON[T any](b []byte) (*T, error)

func ReadServiceCredentialsFromSecret

func ReadServiceCredentialsFromSecret[T any](serviceInfo *v1alpha1.ServiceInfo, ns string, kubeClient kubernetes.Interface) (*T, error)

Types

type CredentialData

type CredentialData struct {
	CredentialType        string `json:"credential-type"`
	ClientId              string `json:"clientid"`
	ClientSecret          string `json:"clientsecret"`
	AuthUrl               string `json:"url"`
	UAADomain             string `json:"uaadomain"`
	ServiceBrokerUrl      string `json:"sburl"`
	CertificateUrl        string `json:"certurl"`
	Certificate           string `json:"certificate"`
	CertificateKey        string `json:"key"`
	VerificationKey       string `json:"verificationkey"`
	CallbackTimeoutMillis string `json:"callbackTimeoutMillis"`
}

type MetadataPropertyDescriptor

type MetadataPropertyDescriptor struct {
	Name       string         `json:"name"`
	SourceName string         `json:"sourceName"`
	Format     PropertyFormat `json:"format"`
	Container  bool           `json:"container"`
}

type PropertyFormat

type PropertyFormat string
const (
	PropertyFormatText PropertyFormat = "text"
	PropertyFormatJSON PropertyFormat = "json"
)

type SaasRegistryCredentials

type SaasRegistryCredentials struct {
	CredentialData `json:",inline"`
	SaasManagerUrl string `json:"saas_registry_url"`
}

type SecretMetadata

type SecretMetadata struct {
	MetadataProperties   []MetadataPropertyDescriptor `json:"metaDataProperties"`
	CredentialProperties []MetadataPropertyDescriptor `json:"credentialProperties"`
}

See Kubernetes-Service-Bindings/doc

type VCAPServiceInstance

type VCAPServiceInstance struct {
	Name         string      `json:"name"` // this attribute holds the binding name if it exists, otherwise, instance name
	BindingGUID  string      `json:"binding_guid,omitempty"`
	BindingName  string      `json:"binding_name,omitempty"`
	InstanceGUID string      `json:"instance_guid,omitempty"`
	InstanceName string      `json:"instance_name,omitempty"`
	Label        string      `json:"label"`
	Plan         string      `json:"plan,omitempty"`
	Credentials  interface{} `json:"credentials"`
	Tags         []string    `json:"tags,omitempty"`
}

type XSUAACredentials

type XSUAACredentials struct {
	CredentialData        `json:",inline"`
	XSAppName             string `json:"xsappname"`
	TrusterClientIDSuffix string `json:"trustedclientidsuffix"`
}

Jump to

Keyboard shortcuts

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