diff --git a/pkg/controller/secretclient.go b/pkg/controller/api.go similarity index 96% rename from pkg/controller/secretclient.go rename to pkg/controller/api.go index 36efd61a..2d3e7da6 100644 --- a/pkg/controller/secretclient.go +++ b/pkg/controller/api.go @@ -81,7 +81,7 @@ func (ac *APICallbacks) Apply(name string) terraform.CallbackFn { if kErr := ac.kube.Get(ctx, nn, tr); kErr != nil { return errors.Wrap(kErr, "cannot get Terraformed resource") } - tr.SetConditions(resource.LastOperationCondition(err)) + tr.SetConditions(resource.AsyncOperationCondition(err)) return errors.Wrap(ac.kube.Status().Update(ctx, tr), errStatusUpdate) } } @@ -95,7 +95,7 @@ func (ac *APICallbacks) Destroy(name string) terraform.CallbackFn { if kErr := ac.kube.Get(ctx, nn, tr); kErr != nil { return errors.Wrap(kErr, "cannot get Terraformed resource") } - tr.SetConditions(resource.LastOperationCondition(err)) + tr.SetConditions(resource.AsyncOperationCondition(err)) return errors.Wrap(ac.kube.Status().Update(ctx, tr), errStatusUpdate) } } diff --git a/pkg/controller/external.go b/pkg/controller/external.go index 4ec88d21..a14ec5e0 100644 --- a/pkg/controller/external.go +++ b/pkg/controller/external.go @@ -111,7 +111,7 @@ type external struct { callback CallbackProvider } -func (e *external) Observe(ctx context.Context, mg xpresource.Managed) (managed.ExternalObservation, error) { +func (e *external) Observe(ctx context.Context, mg xpresource.Managed) (managed.ExternalObservation, error) { //nolint:gocyclo // We skip the gocyclo check because most of the operations are straight-forward // and serial. // TODO(muvaf): Look for ways to reduce the cyclomatic complexity without diff --git a/pkg/controller/external_test.go b/pkg/controller/external_test.go index 4d479895..466f8783 100644 --- a/pkg/controller/external_test.go +++ b/pkg/controller/external_test.go @@ -183,9 +183,8 @@ func TestConnect(t *testing.T) { func TestObserve(t *testing.T) { type args struct { - w Workspace - async bool - obj xpresource.Managed + w Workspace + obj xpresource.Managed } type want struct { obs managed.ExternalObservation diff --git a/pkg/resource/conditions.go b/pkg/resource/conditions.go index 59dca7aa..65602d13 100644 --- a/pkg/resource/conditions.go +++ b/pkg/resource/conditions.go @@ -33,9 +33,9 @@ const ( ReasonSuccess xpv1.ConditionReason = "Success" ) -// LastOperationCondition returns the condition depending on the content +// AsyncOperationCondition returns the condition depending on the content // of the error. -func LastOperationCondition(err error) xpv1.Condition { +func AsyncOperationCondition(err error) xpv1.Condition { switch { case err == nil: return xpv1.Condition{