@@ -26,7 +26,7 @@ type Reader interface {
2626//
2727// Write methods enforce that the resources are owned by the designated owner.
2828type Writer interface {
29- Create (context.Context , resource.Resource ) error
29+ Create (context.Context , resource.Resource , ... CreateOption ) error
3030 Update (context.Context , resource.Resource ) error
3131 Modify (context.Context , resource.Resource , func (resource.Resource ) error , ... ModifyOption ) error
3232 ModifyWithResult (context.Context , resource.Resource , func (resource.Resource ) error , ... ModifyOption ) (resource.Resource , error )
@@ -69,12 +69,28 @@ func ToDeleteOptions(opts ...DeleteOption) DeleteOptions {
6969 return options
7070}
7171
72+ // CreateOptions for operation Create.
73+ type CreateOptions struct {
74+ WithNoOwner bool
75+ }
76+
77+ // WithCreateNoOwner creates the resource without setting the owner.
78+ func WithCreateNoOwner () CreateOption {
79+ return func (o * CreateOptions ) {
80+ o .WithNoOwner = true
81+ }
82+ }
83+
84+ // CreateOption for operation Create.
85+ type CreateOption func (* CreateOptions )
86+
7287// ModifyOption for operation Modify.
7388type ModifyOption func (* ModifyOptions )
7489
7590// ModifyOptions for operation Modify.
7691type ModifyOptions struct {
7792 ExpectedPhase * resource.Phase
93+ WithNoOwner bool
7894}
7995
8096// WithExpectedPhase allows to specify expected phase of the resource.
@@ -91,6 +107,13 @@ func WithExpectedPhaseAny() ModifyOption {
91107 }
92108}
93109
110+ // WithModifyNoOwner creates/updates the resource without setting the owner.
111+ func WithModifyNoOwner () ModifyOption {
112+ return func (o * ModifyOptions ) {
113+ o .WithNoOwner = true
114+ }
115+ }
116+
94117// ToModifyOptions converts variadic options to ModifyOptions.
95118func ToModifyOptions (opts ... ModifyOption ) ModifyOptions {
96119 phase := resource .PhaseRunning
0 commit comments