fix: rename iam to instance (#3345)

* fix: rename iam command side to instance

* fix: rename iam command side to instance

* fix: rename iam command side to instance

* fix: rename iam command side to instance

* fix: rename orgiampolicy to domain policy

* fix: merge conflicts

* fix: protos

* fix: md files

* implement deprecated org iam policy again

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Fabi
2022-03-24 17:21:34 +01:00
committed by GitHub
parent 504fe5b761
commit 9d4f296c62
274 changed files with 12073 additions and 11853 deletions

View File

@@ -11,37 +11,38 @@ import (
const (
//TODO: use for org events as suffix (when possible)
OrgIAMPolicyAddedEventType = "policy.org.iam.added"
OrgIAMPolicyChangedEventType = "policy.org.iam.changed"
DomainPolicyAddedEventType = "policy.domain.added"
DomainPolicyChangedEventType = "policy.domain.changed"
DomainPolicyRemovedEventType = "policy.domain.removed"
)
type OrgIAMPolicyAddedEvent struct {
type DomainPolicyAddedEvent struct {
eventstore.BaseEvent `json:"-"`
UserLoginMustBeDomain bool `json:"userLoginMustBeDomain,omitempty"`
}
func (e *OrgIAMPolicyAddedEvent) Data() interface{} {
func (e *DomainPolicyAddedEvent) Data() interface{} {
return e
}
func (e *OrgIAMPolicyAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
func (e *DomainPolicyAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
return nil
}
func NewOrgIAMPolicyAddedEvent(
func NewDomainPolicyAddedEvent(
base *eventstore.BaseEvent,
userLoginMustBeDomain bool,
) *OrgIAMPolicyAddedEvent {
) *DomainPolicyAddedEvent {
return &OrgIAMPolicyAddedEvent{
return &DomainPolicyAddedEvent{
BaseEvent: *base,
UserLoginMustBeDomain: userLoginMustBeDomain,
}
}
func OrgIAMPolicyAddedEventMapper(event *repository.Event) (eventstore.Event, error) {
e := &OrgIAMPolicyAddedEvent{
func DomainPolicyAddedEventMapper(event *repository.Event) (eventstore.Event, error) {
e := &DomainPolicyAddedEvent{
BaseEvent: *eventstore.BaseEventFromRepo(event),
}
@@ -53,28 +54,28 @@ func OrgIAMPolicyAddedEventMapper(event *repository.Event) (eventstore.Event, er
return e, nil
}
type OrgIAMPolicyChangedEvent struct {
type DomainPolicyChangedEvent struct {
eventstore.BaseEvent `json:"-"`
UserLoginMustBeDomain *bool `json:"userLoginMustBeDomain,omitempty"`
}
func (e *OrgIAMPolicyChangedEvent) Data() interface{} {
func (e *DomainPolicyChangedEvent) Data() interface{} {
return e
}
func (e *OrgIAMPolicyChangedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
func (e *DomainPolicyChangedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
return nil
}
func NewOrgIAMPolicyChangedEvent(
func NewDomainPolicyChangedEvent(
base *eventstore.BaseEvent,
changes []OrgIAMPolicyChanges,
) (*OrgIAMPolicyChangedEvent, error) {
changes []OrgPolicyChanges,
) (*DomainPolicyChangedEvent, error) {
if len(changes) == 0 {
return nil, errors.ThrowPreconditionFailed(nil, "POLICY-DAf3h", "Errors.NoChangesFound")
}
changeEvent := &OrgIAMPolicyChangedEvent{
changeEvent := &DomainPolicyChangedEvent{
BaseEvent: *base,
}
for _, change := range changes {
@@ -83,16 +84,16 @@ func NewOrgIAMPolicyChangedEvent(
return changeEvent, nil
}
type OrgIAMPolicyChanges func(*OrgIAMPolicyChangedEvent)
type OrgPolicyChanges func(*DomainPolicyChangedEvent)
func ChangeUserLoginMustBeDomain(userLoginMustBeDomain bool) func(*OrgIAMPolicyChangedEvent) {
return func(e *OrgIAMPolicyChangedEvent) {
func ChangeUserLoginMustBeDomain(userLoginMustBeDomain bool) func(*DomainPolicyChangedEvent) {
return func(e *DomainPolicyChangedEvent) {
e.UserLoginMustBeDomain = &userLoginMustBeDomain
}
}
func OrgIAMPolicyChangedEventMapper(event *repository.Event) (eventstore.Event, error) {
e := &OrgIAMPolicyChangedEvent{
func DomainPolicyChangedEventMapper(event *repository.Event) (eventstore.Event, error) {
e := &DomainPolicyChangedEvent{
BaseEvent: *eventstore.BaseEventFromRepo(event),
}
@@ -104,26 +105,26 @@ func OrgIAMPolicyChangedEventMapper(event *repository.Event) (eventstore.Event,
return e, nil
}
type OrgIAMPolicyRemovedEvent struct {
type DomainPolicyRemovedEvent struct {
eventstore.BaseEvent `json:"-"`
}
func (e *OrgIAMPolicyRemovedEvent) Data() interface{} {
func (e *DomainPolicyRemovedEvent) Data() interface{} {
return nil
}
func (e *OrgIAMPolicyRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
func (e *DomainPolicyRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint {
return nil
}
func NewOrgIAMPolicyRemovedEvent(base *eventstore.BaseEvent) *OrgIAMPolicyRemovedEvent {
return &OrgIAMPolicyRemovedEvent{
func NewDomainPolicyRemovedEvent(base *eventstore.BaseEvent) *DomainPolicyRemovedEvent {
return &DomainPolicyRemovedEvent{
BaseEvent: *base,
}
}
func OrgIAMPolicyRemovedEventMapper(event *repository.Event) (eventstore.Event, error) {
return &OrgIAMPolicyRemovedEvent{
func DomainPolicyRemovedEventMapper(event *repository.Event) (eventstore.Event, error) {
return &DomainPolicyRemovedEvent{
BaseEvent: *eventstore.BaseEventFromRepo(event),
}, nil
}