adlerhurst ebeedd1346 policy, idp, member.
member not working atm
2020-11-30 06:40:56 +01:00

52 lines
952 B
Go

package provider
import (
"encoding/json"
"github.com/caos/zitadel/internal/errors"
"github.com/caos/zitadel/internal/eventstore/v2"
"github.com/caos/zitadel/internal/eventstore/v2/repository"
)
const (
RemovedEventType = "idpprovider.removed"
)
type RemovedEvent struct {
eventstore.BaseEvent
IDPConfigID string `json:"idpConfigId"`
}
func (e *RemovedEvent) CheckPrevious() bool {
return true
}
func (e *RemovedEvent) Data() interface{} {
return e
}
func NewRemovedEvent(
base *eventstore.BaseEvent,
idpConfigID string,
) *RemovedEvent {
return &RemovedEvent{
BaseEvent: *base,
IDPConfigID: idpConfigID,
}
}
func RemovedEventEventMapper(event *repository.Event) (eventstore.EventReader, error) {
e := &RemovedEvent{
BaseEvent: *eventstore.BaseEventFromRepo(event),
}
err := json.Unmarshal(event.Data, e)
if err != nil {
return nil, errors.ThrowInternal(err, "PROVI-6H0KQ", "Errors.Internal")
}
return e, nil
}