Documentation
¶
Overview ¶
Package btp detects SAP BTP service bindings and resolves named BTP Destination Service entries (plus a Connectivity dialer for on-premise tunneling). Everything is optional: Detect returns nil outside Cloud Foundry/Kyma, and a nil *Bindings is safe to use — Resolve then reports ErrNoBinding.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoBinding = errors.New("no BTP Connectivity/Destination binding detected in this environment")
ErrNoBinding is returned by Resolve when no BTP Connectivity + Destination binding was detected in this environment.
Functions ¶
This section is empty.
Types ¶
type Bindings ¶
type Bindings struct {
Connectivity *binding.ConnectivityBinding
Destination *binding.DestinationBinding
}
Bindings holds resolved SAP BTP service bindings.
func Detect ¶
func Detect() *Bindings
Detect resolves BTP Connectivity and Destination service bindings via btp-go's binding/auto (VCAP_SERVICES on Cloud Foundry, SERVICE_BINDING_ROOT or /bindings on Kyma). It returns nil (not an error) when no BTP environment is present — the expected, common case outside Cloud Foundry/Kyma.
func (*Bindings) Resolve ¶
func (b *Bindings) Resolve(ctx context.Context, name string) (*destination.Destination, *connectivity.Dialer, error)
Resolve looks up name in the BTP Destination Service and returns the resolved destination plus a Connectivity dialer for tunneling on-premise traffic through Cloud Connector. Callers should route through the dialer only when dest.ProxyType == "OnPremise" (building the dialer itself performs no network I/O, so it's always cheap to return one). Shared by any source or target that needs to resolve a named BTP destination — source.SFTP and the db drivers all call this. A nil *Bindings is valid and returns ErrNoBinding, so b.Resolve can be passed around unconditionally.