Closed applike-ss closed 1 month ago
I think the right way to solve this would be to add a string-transform of type "replace". It would follow the P&T concept of
- type: CombineFromComposite
combine:
variables:
- fromFieldPath: status.availability
- fromFieldPath: spec.claimRef.namespace
- fromFieldPath: spec.parameters.name
strategy: string
string:
fmt: "%s.%s.%s"
toFieldPath: spec.forProvider.topic.name
transforms:
- type: string
string:
type: Replace
replace:
search: "public"
replace: "pub"
So the replace would happen after the combine (the original ticket would also support replace to the "fromField" before the combine).
If this makes sense I would implement it.
Sounds logical 👍 Thanks for the feedback!
It PR was merged and this should be available in the next released version. @negz @jeanduplessis I also added documentation for it, but don't know if it makes sense, as this is now only available with the P&T composition function: https://github.com/crossplane/docs/pull/796
I think it makes sense to land that PR once the docs have been updated to be "function-first": https://github.com/crossplane/docs/issues/791
this was implemented and released with v0.7.0, issue can be closed
As per this comment: https://github.com/crossplane/crossplane/issues/3025#issuecomment-1937911181 i assume that this is the right place to post this request.
I would like to see a simple string replacement implementation, that could be used like this:
Originally taken from: https://github.com/crossplane/crossplane/issues/3026 but slightly adjusted.
The code snippet is just a rough example and may not be perfectly matching how inputs for the function should be specified.