-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Hasan Turken <[email protected]>
- Loading branch information
Showing
3 changed files
with
150 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package fake | ||
|
||
import ( | ||
"context" | ||
|
||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | ||
|
||
"github.com/crossplane-contrib/provider-kubernetes/apis/object/v1alpha2" | ||
) | ||
|
||
// A ResourceSyncer is a fake ResourceSyncer. | ||
type ResourceSyncer struct { | ||
GetObservedStateFn func(ctx context.Context, obj *v1alpha2.Object, current *unstructured.Unstructured) (*unstructured.Unstructured, error) | ||
GetDesiredStateFn func(ctx context.Context, obj *v1alpha2.Object, manifest *unstructured.Unstructured) (*unstructured.Unstructured, error) | ||
SyncResourceFn func(ctx context.Context, obj *v1alpha2.Object, desired *unstructured.Unstructured) (*unstructured.Unstructured, error) | ||
} | ||
|
||
// GetObservedState calls the GetObservedStateFn. | ||
func (r *ResourceSyncer) GetObservedState(ctx context.Context, obj *v1alpha2.Object, current *unstructured.Unstructured) (*unstructured.Unstructured, error) { | ||
return r.GetObservedStateFn(ctx, obj, current) | ||
} | ||
|
||
// GetDesiredState calls the GetDesiredStateFn. | ||
func (r *ResourceSyncer) GetDesiredState(ctx context.Context, obj *v1alpha2.Object, manifest *unstructured.Unstructured) (*unstructured.Unstructured, error) { | ||
return r.GetDesiredStateFn(ctx, obj, manifest) | ||
} | ||
|
||
// SyncResource calls the SyncResourceFn. | ||
func (r *ResourceSyncer) SyncResource(ctx context.Context, obj *v1alpha2.Object, desired *unstructured.Unstructured) (*unstructured.Unstructured, error) { | ||
return r.SyncResourceFn(ctx, obj, desired) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.