MCPcopy Create free account
hub / github.com/crossplane-contrib/function-patch-and-transform / getConnectionSecretRef

Function getConnectionSecretRef

connection.go:129–141  ·  view source on GitHub ↗

getConnectionSecretRef creates a connection secret reference from the given XR and input. The patches for the reference will be applied before the reference is returned.

(xr *resource.Composite, input *v1beta1.WriteConnectionSecretToRef)

Source from the content-addressed store, hash-verified

127// XR and input. The patches for the reference will be applied before the
128// reference is returned.
129func getConnectionSecretRef(xr *resource.Composite, input *v1beta1.WriteConnectionSecretToRef) (xpv1.SecretReference, error) {
130 // Get the base connection secret ref to start with
131 ref := getBaseConnectionSecretRef(xr, input)
132
133 // Apply patches to the base connection secret ref if they've been provided
134 if input != nil && len(input.Patches) > 0 {
135 if err := applyConnectionSecretPatches(xr, &ref, input.Patches); err != nil {
136 return xpv1.SecretReference{}, errors.Wrap(err, "cannot apply connection secret patches")
137 }
138 }
139
140 return ref, nil
141}
142
143// getBaseConnectionSecretRef determines the base connection secret reference
144// without any patches. This reference is generated with the following

Callers 2

composeConnectionSecretFunction · 0.85

Calls 2

Tested by 1