mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:07:31 +00:00
feat: instance remove (#4345)
* feat(instance): add remove instance event with projections cleanup * fix(instance): corrected used id to clean up projections * fix merge * fix: correct unit test projection names * fix: current sequence of lists and query for ensuring keypair based projections Co-authored-by: Livio Spring <livio.a@gmail.com> Co-authored-by: Fabi <38692350+hifabienne@users.noreply.github.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/zitadel/zitadel/internal/errors"
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
"github.com/zitadel/zitadel/internal/query"
|
||||
"github.com/zitadel/zitadel/internal/repository/instance"
|
||||
"github.com/zitadel/zitadel/internal/repository/keypair"
|
||||
"github.com/zitadel/zitadel/internal/telemetry/tracing"
|
||||
)
|
||||
@@ -29,7 +30,7 @@ const (
|
||||
gracefulPeriod = 10 * time.Minute
|
||||
)
|
||||
|
||||
//SigningKey wraps the query.PrivateKey to implement the op.SigningKey interface
|
||||
// SigningKey wraps the query.PrivateKey to implement the op.SigningKey interface
|
||||
type SigningKey struct {
|
||||
algorithm jose.SignatureAlgorithm
|
||||
id string
|
||||
@@ -48,7 +49,7 @@ func (s *SigningKey) ID() string {
|
||||
return s.id
|
||||
}
|
||||
|
||||
//PublicKey wraps the query.PublicKey to implement the op.Key interface
|
||||
// PublicKey wraps the query.PublicKey to implement the op.Key interface
|
||||
type PublicKey struct {
|
||||
key query.PublicKey
|
||||
}
|
||||
@@ -69,7 +70,7 @@ func (s *PublicKey) ID() string {
|
||||
return s.key.ID()
|
||||
}
|
||||
|
||||
//KeySet implements the op.Storage interface
|
||||
// KeySet implements the op.Storage interface
|
||||
func (o *OPStorage) KeySet(ctx context.Context) (keys []op.Key, err error) {
|
||||
ctx, span := tracing.NewSpan(ctx)
|
||||
defer func() { span.EndWithError(err) }()
|
||||
@@ -87,7 +88,7 @@ func (o *OPStorage) KeySet(ctx context.Context) (keys []op.Key, err error) {
|
||||
return keys, err
|
||||
}
|
||||
|
||||
//SignatureAlgorithms implements the op.Storage interface
|
||||
// SignatureAlgorithms implements the op.Storage interface
|
||||
func (o *OPStorage) SignatureAlgorithms(ctx context.Context) ([]jose.SignatureAlgorithm, error) {
|
||||
key, err := o.SigningKey(ctx)
|
||||
if err != nil {
|
||||
@@ -96,7 +97,7 @@ func (o *OPStorage) SignatureAlgorithms(ctx context.Context) ([]jose.SignatureAl
|
||||
return []jose.SignatureAlgorithm{key.SignatureAlgorithm()}, nil
|
||||
}
|
||||
|
||||
//SigningKey implements the op.Storage interface
|
||||
// SigningKey implements the op.Storage interface
|
||||
func (o *OPStorage) SigningKey(ctx context.Context) (key op.SigningKey, err error) {
|
||||
err = retry(func() error {
|
||||
key, err = o.getSigningKey(ctx)
|
||||
@@ -186,7 +187,7 @@ func (o *OPStorage) getMaxKeySequence(ctx context.Context) (uint64, error) {
|
||||
eventstore.NewSearchQueryBuilder(eventstore.ColumnsMaxSequence).
|
||||
ResourceOwner(authz.GetInstance(ctx).InstanceID()).
|
||||
AddQuery().
|
||||
AggregateTypes(keypair.AggregateType).
|
||||
AggregateTypes(keypair.AggregateType, instance.AggregateType).
|
||||
Builder(),
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user