Commit Graph

9 Commits

Author SHA1 Message Date
Nic Cope 1f3ee551a0 Switch the SDK to use v1 protos
v1 is currently identical to v1beta1. Upstream we have automation that
makes sure the two protos are identical (apart from their package).

Signed-off-by: Nic Cope <nicc@rk0n.org>
2024-08-16 13:20:45 -07:00
dalton hill 9de531150e Composition function status conditions and claim events.
Signed-off-by: Dalton Hill <dalton.hill.0@protonmail.com>
2024-06-27 09:14:49 -05:00
Nic Cope a11b5d9bfc Bump golangci-lint to v1.55.1
Notably this includes a handy new linter that warns when you don't use
GetFoo methods to access protobuf fields.

Signed-off-by: Nic Cope <nicc@rk0n.org>
2023-10-25 16:13:34 -07:00
Nic Cope ffe3c155b4 Handle nil context fields, not just a nil context
Found while testing https://github.com/crossplane-contrib/function-patch-and-transform/pull/17

Signed-off-by: Nic Cope <nicc@rk0n.org>
2023-10-16 16:28:38 -07:00
Nic Cope 0eb69ebaea Support injecting Function environment via context
This is the Go SDK end of https://github.com/crossplane/crossplane/pull/4632

Signed-off-by: Nic Cope <nicc@rk0n.org>
2023-10-12 18:29:31 -07:00
Philippe Scorsolini 5b013ffc4d
feat: introduce logging and errors packages
Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
2023-09-27 12:24:57 +02:00
Nic Cope fce65c0f3f Make desired resources map values pointers to struct
This makes it possible to mutate struct values while iterating over the
map of composed resources. I found myself naturally wanting to do this
while writing a Function. e.g.:

desired, _ = request.GetDesiredComposedResources(req)

for _, dr := range desired {
	dr.Ready = resource.ReadyTrue
}

_ = response.SetDesiredComposedResources(desired)

I haven't made the same change for observed resources, since they're
supposed to be read-only to a Function.

Signed-off-by: Nic Cope <nicc@rk0n.org>
2023-09-15 19:01:21 -07:00
Nic Cope ef3a2e04d3 Remove DesiredComposedResources and ObserveComposedResources types
These just served to obfuscate what the types actually were - a map of
resource name to observed/desired composed resource structs.

Signed-off-by: Nic Cope <nicc@rk0n.org>
2023-09-15 18:59:34 -07:00
Nic Cope 8dd124b7a5 Add the beginnings of a Function SDK
I'm sure this won't be close to the end shape of this SDK, but I want to
start somewhere. This is essentially a few utilities I found I wanted
when writing https://github.com/crossplane-contrib/function-patch-and-transform

Signed-off-by: Nic Cope <nicc@rk0n.org>
2023-09-12 05:45:19 -07:00