Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
controller: rename secretclient to api since it contains more than se…
Browse files Browse the repository at this point in the history
…cret utils now

Signed-off-by: Muvaffak Onus <me@muvaf.com>
  • Loading branch information
muvaf committed Oct 22, 2021
1 parent b249ad8 commit 94f4d95
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pkg/controller/secretclient.go → pkg/controller/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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)
}
}
2 changes: 1 addition & 1 deletion pkg/controller/external.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions pkg/controller/external_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkg/resource/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 94f4d95

Please sign in to comment.