diff --git a/apps/secret/inline/v1beta1/inline.pb.go b/apps/secret/inline/v1beta1/inline.pb.go index d759693f4e0..5f73010f039 100644 --- a/apps/secret/inline/v1beta1/inline.pb.go +++ b/apps/secret/inline/v1beta1/inline.pb.go @@ -296,8 +296,8 @@ type DeleteWhenOwnedByResourceRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Owner reference. Owner *ObjectReference `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - // Name of the secure value to delete. - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Name of the secure values to delete. + Names []string `protobuf:"bytes,2,rep,name=names,proto3" json:"names,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -339,11 +339,11 @@ func (x *DeleteWhenOwnedByResourceRequest) GetOwner() *ObjectReference { return nil } -func (x *DeleteWhenOwnedByResourceRequest) GetName() string { +func (x *DeleteWhenOwnedByResourceRequest) GetNames() []string { if x != nil { - return x.Name + return x.Names } - return "" + return nil } type DeleteWhenOwnedByResourceResponse struct { @@ -413,42 +413,43 @@ var file_inline_v1beta1_inline_proto_rawDesc = string([]byte{ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x2a, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x6c, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x6e, 0x0a, 0x20, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x57, 0x68, 0x65, 0x6e, 0x4f, 0x77, 0x6e, 0x65, 0x64, 0x42, 0x79, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x23, 0x0a, 0x21, + 0x65, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6d, 0x65, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x23, + 0x0a, 0x21, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x57, 0x68, 0x65, 0x6e, 0x4f, 0x77, 0x6e, 0x65, + 0x64, 0x42, 0x79, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x32, 0xcc, 0x02, 0x0a, 0x18, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x65, + 0x63, 0x75, 0x72, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x57, 0x0a, 0x0c, 0x43, 0x61, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, + 0x12, 0x22, 0x2e, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x43, 0x61, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x61, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x0c, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x22, 0x2e, 0x69, 0x6e, 0x6c, 0x69, + 0x6e, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, + 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x7e, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x57, 0x68, 0x65, 0x6e, + 0x4f, 0x77, 0x6e, 0x65, 0x64, 0x42, 0x79, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, + 0x2f, 0x2e, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x57, 0x68, 0x65, 0x6e, 0x4f, 0x77, 0x6e, 0x65, 0x64, 0x42, - 0x79, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x32, 0xcc, 0x02, 0x0a, 0x18, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x65, 0x63, 0x75, - 0x72, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x57, - 0x0a, 0x0c, 0x43, 0x61, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x22, - 0x2e, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, - 0x61, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x43, 0x61, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x22, 0x2e, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x6e, - 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x69, 0x6e, - 0x6c, 0x69, 0x6e, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x7e, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x57, 0x68, 0x65, 0x6e, 0x4f, 0x77, - 0x6e, 0x65, 0x64, 0x42, 0x79, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2f, 0x2e, - 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x57, 0x68, 0x65, 0x6e, 0x4f, 0x77, 0x6e, 0x65, 0x64, 0x42, 0x79, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, - 0x2e, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x57, 0x68, 0x65, 0x6e, 0x4f, 0x77, 0x6e, 0x65, 0x64, 0x42, 0x79, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, - 0x72, 0x61, 0x66, 0x61, 0x6e, 0x61, 0x2f, 0x67, 0x72, 0x61, 0x66, 0x61, 0x6e, 0x61, 0x2f, 0x61, - 0x70, 0x70, 0x73, 0x2f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x2f, 0x69, 0x6e, 0x6c, 0x69, 0x6e, - 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x79, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x30, 0x2e, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x57, 0x68, 0x65, 0x6e, 0x4f, 0x77, 0x6e, 0x65, 0x64, + 0x42, 0x79, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x42, 0x45, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x67, 0x72, 0x61, 0x66, 0x61, 0x6e, 0x61, 0x2f, 0x67, 0x72, 0x61, 0x66, 0x61, 0x6e, 0x61, + 0x2f, 0x61, 0x70, 0x70, 0x73, 0x2f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x2f, 0x69, 0x6e, 0x6c, + 0x69, 0x6e, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x69, 0x6e, 0x6c, 0x69, + 0x6e, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, }) var ( diff --git a/apps/secret/inline/v1beta1/inline.proto b/apps/secret/inline/v1beta1/inline.proto index 493b855c517..d0edcfa7395 100644 --- a/apps/secret/inline/v1beta1/inline.proto +++ b/apps/secret/inline/v1beta1/inline.proto @@ -49,8 +49,8 @@ message DeleteWhenOwnedByResourceRequest { // Owner reference. ObjectReference owner = 1; - // Name of the secure value to delete. - string name = 2; + // Name of the secure values to delete. + repeated string names = 2; } message DeleteWhenOwnedByResourceResponse {} diff --git a/pkg/registry/apis/secret/contracts/inline.go b/pkg/registry/apis/secret/contracts/inline.go index f2f3de71568..997d5518e87 100644 --- a/pkg/registry/apis/secret/contracts/inline.go +++ b/pkg/registry/apis/secret/contracts/inline.go @@ -15,5 +15,5 @@ type InlineSecureValueSupport interface { CreateInline(ctx context.Context, owner common.ObjectReference, value common.RawSecureValue) (string, error) // DeleteWhenOwnedByResource removes secrets if and only if they are owned by a referenced object - DeleteWhenOwnedByResource(ctx context.Context, owner common.ObjectReference, name string) error + DeleteWhenOwnedByResource(ctx context.Context, owner common.ObjectReference, names ...string) error } diff --git a/pkg/registry/apis/secret/inline/grpc_client.go b/pkg/registry/apis/secret/inline/grpc_client.go index 8ccfbb7dad3..9ca027e2c00 100644 --- a/pkg/registry/apis/secret/inline/grpc_client.go +++ b/pkg/registry/apis/secret/inline/grpc_client.go @@ -156,7 +156,7 @@ func (g *GRPCInlineClient) CreateInline(ctx context.Context, owner v0alpha1.Obje return resp.GetName(), nil } -func (g *GRPCInlineClient) DeleteWhenOwnedByResource(ctx context.Context, owner v0alpha1.ObjectReference, name string) error { +func (g *GRPCInlineClient) DeleteWhenOwnedByResource(ctx context.Context, owner v0alpha1.ObjectReference, names ...string) error { client, err := g.getClient(owner.Namespace) if err != nil { return err @@ -170,7 +170,7 @@ func (g *GRPCInlineClient) DeleteWhenOwnedByResource(ctx context.Context, owner Namespace: owner.Namespace, Name: owner.Name, }, - Name: name, + Names: names, } _, err = client.DeleteWhenOwnedByResource(ctx, req) diff --git a/pkg/registry/apis/secret/inline/inline_secure_value.go b/pkg/registry/apis/secret/inline/inline_secure_value.go index 65aae4efe9f..3dfb191ca62 100644 --- a/pkg/registry/apis/secret/inline/inline_secure_value.go +++ b/pkg/registry/apis/secret/inline/inline_secure_value.go @@ -26,6 +26,8 @@ type LocalInlineSecureValueService struct { accessChecker authlib.AccessChecker } +var _ contracts.InlineSecureValueSupport = &LocalInlineSecureValueService{} + func NewLocalInlineSecureValueService( tracer trace.Tracer, secureValueService contracts.SecureValueService, @@ -219,14 +221,14 @@ func (s *LocalInlineSecureValueService) CreateInline(ctx context.Context, owner return createdSv.GetName(), nil } -func (s *LocalInlineSecureValueService) DeleteWhenOwnedByResource(ctx context.Context, owner common.ObjectReference, name string) error { +func (s *LocalInlineSecureValueService) DeleteWhenOwnedByResource(ctx context.Context, owner common.ObjectReference, names ...string) error { ctx, span := s.tracer.Start(ctx, "InlineSecureValueService.DeleteWhenOwnedByResource", trace.WithAttributes( attribute.String("owner.namespace", owner.Namespace), attribute.String("owner.apiGroup", owner.APIGroup), attribute.String("owner.apiVersion", owner.APIVersion), attribute.String("owner.kind", owner.Kind), attribute.String("owner.name", owner.Name), - attribute.String("secureValue.name", name), + attribute.StringSlice("secureValueNames", names), )) defer span.End() @@ -243,17 +245,18 @@ func (s *LocalInlineSecureValueService) DeleteWhenOwnedByResource(ctx context.Co return fmt.Errorf("owner reference must have a valid API group, API version, kind and name") } - owned, err := s.isSecureValueOwnedByResource(ctx, owner, name) - if err != nil { - return fmt.Errorf("error checking if secure value %s is owned by %v: %w", name, owner, err) - } + for _, name := range names { + owned, err := s.isSecureValueOwnedByResource(ctx, owner, name) + if err != nil { + return fmt.Errorf("error checking if secure value %s is owned by %v: %w", name, owner, err) + } - if owned { - if _, err := s.secureValueService.Delete(ctx, xkube.Namespace(owner.Namespace), name); err != nil { - return fmt.Errorf("error deleting secure value %s for owner %v: %w", name, owner, err) + if owned { + if _, err := s.secureValueService.Delete(ctx, xkube.Namespace(owner.Namespace), name); err != nil { + return fmt.Errorf("error deleting secure value %s for owner %v: %w", name, owner, err) + } } } - // if it is not owned, this is a no-op return nil } diff --git a/pkg/registry/apis/secret/inline/inline_secure_value_test.go b/pkg/registry/apis/secret/inline/inline_secure_value_test.go index f95a9280985..9c058622810 100644 --- a/pkg/registry/apis/secret/inline/inline_secure_value_test.go +++ b/pkg/registry/apis/secret/inline/inline_secure_value_test.go @@ -507,4 +507,31 @@ func TestIntegration_InlineSecureValue_DeleteWhenOwnedByResource(t *testing.T) { require.NotNil(t, sv) require.Equal(t, sv1, sv.GetName()) }) + + t.Run("when a secure value is owned and exists but another one doesnt, it deletes the first one but returns an error", func(t *testing.T) { + t.Parallel() + + tu := testutils.Setup(t) + + sv1 := "test-secure-value-1" + createdSv1, err := tu.CreateSv(t.Context(), func(cfg *testutils.CreateSvConfig) { + cfg.Sv.Name = sv1 + cfg.Sv.Namespace = defaultNs + cfg.Sv.OwnerReferences = []metav1.OwnerReference{owner.ToOwnerReference()} + }) + require.NoError(t, err) + require.NotNil(t, createdSv1) + + svc := inline.NewLocalInlineSecureValueService(tracer, tu.SecureValueService, nil) + + ctx := testutils.CreateServiceAuthContext(t.Context(), "", defaultNs, nil) + + err = svc.DeleteWhenOwnedByResource(ctx, owner, sv1, "does-not-exist") + require.ErrorIs(t, err, contracts.ErrSecureValueNotFound) + + // got deleted + sv, err := tu.SecureValueService.Read(ctx, xkube.Namespace(owner.Namespace), sv1) + require.ErrorIs(t, err, contracts.ErrSecureValueNotFound) + require.Nil(t, sv) + }) } diff --git a/pkg/registry/apis/secret/inline_mock.go b/pkg/registry/apis/secret/inline_mock.go index 468aaa594d2..81f78e389f8 100644 --- a/pkg/registry/apis/secret/inline_mock.go +++ b/pkg/registry/apis/secret/inline_mock.go @@ -143,17 +143,24 @@ func (_c *MockInlineSecureValueSupport_CreateInline_Call) RunAndReturn(run func( return _c } -// DeleteWhenOwnedByResource provides a mock function with given fields: ctx, owner, name -func (_m *MockInlineSecureValueSupport) DeleteWhenOwnedByResource(ctx context.Context, owner v0alpha1.ObjectReference, name string) error { - ret := _m.Called(ctx, owner, name) +// DeleteWhenOwnedByResource provides a mock function with given fields: ctx, owner, names +func (_m *MockInlineSecureValueSupport) DeleteWhenOwnedByResource(ctx context.Context, owner v0alpha1.ObjectReference, names ...string) error { + _va := make([]interface{}, len(names)) + for _i := range names { + _va[_i] = names[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, owner) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) if len(ret) == 0 { panic("no return value specified for DeleteWhenOwnedByResource") } var r0 error - if rf, ok := ret.Get(0).(func(context.Context, v0alpha1.ObjectReference, string) error); ok { - r0 = rf(ctx, owner, name) + if rf, ok := ret.Get(0).(func(context.Context, v0alpha1.ObjectReference, ...string) error); ok { + r0 = rf(ctx, owner, names...) } else { r0 = ret.Error(0) } @@ -169,14 +176,21 @@ type MockInlineSecureValueSupport_DeleteWhenOwnedByResource_Call struct { // DeleteWhenOwnedByResource is a helper method to define mock.On call // - ctx context.Context // - owner v0alpha1.ObjectReference -// - name string -func (_e *MockInlineSecureValueSupport_Expecter) DeleteWhenOwnedByResource(ctx interface{}, owner interface{}, name interface{}) *MockInlineSecureValueSupport_DeleteWhenOwnedByResource_Call { - return &MockInlineSecureValueSupport_DeleteWhenOwnedByResource_Call{Call: _e.mock.On("DeleteWhenOwnedByResource", ctx, owner, name)} +// - names ...string +func (_e *MockInlineSecureValueSupport_Expecter) DeleteWhenOwnedByResource(ctx interface{}, owner interface{}, names ...interface{}) *MockInlineSecureValueSupport_DeleteWhenOwnedByResource_Call { + return &MockInlineSecureValueSupport_DeleteWhenOwnedByResource_Call{Call: _e.mock.On("DeleteWhenOwnedByResource", + append([]interface{}{ctx, owner}, names...)...)} } -func (_c *MockInlineSecureValueSupport_DeleteWhenOwnedByResource_Call) Run(run func(ctx context.Context, owner v0alpha1.ObjectReference, name string)) *MockInlineSecureValueSupport_DeleteWhenOwnedByResource_Call { +func (_c *MockInlineSecureValueSupport_DeleteWhenOwnedByResource_Call) Run(run func(ctx context.Context, owner v0alpha1.ObjectReference, names ...string)) *MockInlineSecureValueSupport_DeleteWhenOwnedByResource_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v0alpha1.ObjectReference), args[2].(string)) + variadicArgs := make([]string, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(context.Context), args[1].(v0alpha1.ObjectReference), variadicArgs...) }) return _c } @@ -186,7 +200,7 @@ func (_c *MockInlineSecureValueSupport_DeleteWhenOwnedByResource_Call) Return(_a return _c } -func (_c *MockInlineSecureValueSupport_DeleteWhenOwnedByResource_Call) RunAndReturn(run func(context.Context, v0alpha1.ObjectReference, string) error) *MockInlineSecureValueSupport_DeleteWhenOwnedByResource_Call { +func (_c *MockInlineSecureValueSupport_DeleteWhenOwnedByResource_Call) RunAndReturn(run func(context.Context, v0alpha1.ObjectReference, ...string) error) *MockInlineSecureValueSupport_DeleteWhenOwnedByResource_Call { _c.Call.Return(run) return _c }