func (s *BindOperation) Insert(bo *internal.BindOperation) error {
	opKey := s.key(bo.InstanceID, bo.BindingID, bo.OperationID)
	respGet, err := s.kv.Get(context.TODO(), opKey)
	if err != nil {
		return errors.Wrap(err, "while getting bind operation")
	}
	if respGet.Count > 0 {
		return alreadyExistsError{}
	}
	opInProgress, err := s.isOperationInProgress(bo.InstanceID, bo.BindingID)
	if err != nil {
		return errors.Wrap(err, "while checking if there are operations in progress")
	}
	if *opInProgress {
		return activeOperationInProgressError{}
	}
	bo.CreatedAt = s.nowProvider.Now()
	dso, err := s.encodeDMToDSO(bo)
	if err != nil {
		return err
	}
	if _, err := s.kv.Put(context.TODO(), opKey, dso); err != nil {
		return errors.Wrap(err, "while putting bind operation")
	}
	return nil
}
Insert inserts object into storage.
package etcd
import (
	"bytes"
	"context"
	"encoding/gob"
	"strings"
	"time"
	"github.com/pkg/errors"
	"go.etcd.io/etcd/clientv3"
	"go.etcd.io/etcd/clientv3/namespace"
	"github.com/kyma-project/helm-broker/internal/platform/ptr"
	yTime "github.com/kyma-project/helm-broker/internal/platform/time"
	"github.com/kyma-project/helm-broker/internal"
)
func NewBindOperation(cli clientv3.KV) (*BindOperation, error) {
	prefixParts := append(entityNamespacePrefixParts(), string(entityNamespaceBindOperation))
	kv := namespace.NewKV(cli, strings.Join(prefixParts, entityNamespaceSeparator))
	d := &BindOperation{
		generic: generic{
			kv: kv,
		},
	}
	return d, nil
}
type BindOperation struct {
	generic
	nowProvider yTime.NowProvider
}
func (s *BindOperation) WithTimeProvider(nowProvider func() time.Time) *BindOperation {
	s.nowProvider = nowProvider
	return s
}