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)
| 127 | // XR and input. The patches for the reference will be applied before the |
| 128 | // reference is returned. |
| 129 | func 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 |