feat: asset storage (#1696)

* feat: remove assets

* feat: minio implementation

* fix: remove assets from tests

* feat: minio implementation

* feat: Env vars

* fix: sprintf

* fix: sprintf

* Update internal/eventstore/repository/repository.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* fix: error handling

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Fabi
2021-05-03 10:15:50 +02:00
committed by GitHub
parent a5c6bf5498
commit 667cc30291
110 changed files with 306 additions and 938 deletions

View File

@@ -36,10 +36,6 @@ func (e *APIConfigAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConst
return nil
}
func (e *APIConfigAddedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewAPIConfigAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -90,10 +86,6 @@ func (e *APIConfigChangedEvent) UniqueConstraints() []*eventstore.EventUniqueCon
return nil
}
func (e *APIConfigChangedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewAPIConfigChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -154,10 +146,6 @@ func (e *APIConfigSecretChangedEvent) UniqueConstraints() []*eventstore.EventUni
return nil
}
func (e *APIConfigSecretChangedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewAPIConfigSecretChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -202,10 +190,6 @@ func (e *APIConfigSecretCheckSucceededEvent) UniqueConstraints() []*eventstore.E
return nil
}
func (e *APIConfigSecretCheckSucceededEvent) Assets() []*eventstore.Asset {
return nil
}
func NewAPIConfigSecretCheckSucceededEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -248,10 +232,6 @@ func (e *APIConfigSecretCheckFailedEvent) UniqueConstraints() []*eventstore.Even
return nil
}
func (e *APIConfigSecretCheckFailedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewAPIConfigSecretCheckFailedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,

View File

@@ -48,10 +48,6 @@ func (e *ApplicationAddedEvent) UniqueConstraints() []*eventstore.EventUniqueCon
return []*eventstore.EventUniqueConstraint{NewAddApplicationUniqueConstraint(e.Name, e.Aggregate().ID)}
}
func (e *ApplicationAddedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewApplicationAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -101,10 +97,6 @@ func (e *ApplicationChangedEvent) UniqueConstraints() []*eventstore.EventUniqueC
}
}
func (e *ApplicationChangedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewApplicationChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -151,10 +143,6 @@ func (e *ApplicationDeactivatedEvent) UniqueConstraints() []*eventstore.EventUni
return nil
}
func (e *ApplicationDeactivatedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewApplicationDeactivatedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -197,10 +185,6 @@ func (e *ApplicationReactivatedEvent) UniqueConstraints() []*eventstore.EventUni
return nil
}
func (e *ApplicationReactivatedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewApplicationReactivatedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -244,10 +228,6 @@ func (e *ApplicationRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueC
return []*eventstore.EventUniqueConstraint{NewRemoveApplicationUniqueConstraint(e.name, e.Aggregate().ID)}
}
func (e *ApplicationRemovedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewApplicationRemovedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,

View File

@@ -50,10 +50,6 @@ func (e *GrantAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstrain
return []*eventstore.EventUniqueConstraint{NewAddProjectGrantUniqueConstraint(e.GrantedOrgID, e.Aggregate().ID)}
}
func (e *GrantAddedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewGrantAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -101,10 +97,6 @@ func (e *GrantChangedEvent) UniqueConstraints() []*eventstore.EventUniqueConstra
return nil
}
func (e *GrantChangedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewGrantChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -150,10 +142,6 @@ func (e *GrantCascadeChangedEvent) UniqueConstraints() []*eventstore.EventUnique
return nil
}
func (e *GrantCascadeChangedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewGrantCascadeChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -198,10 +186,6 @@ func (e *GrantDeactivateEvent) UniqueConstraints() []*eventstore.EventUniqueCons
return nil
}
func (e *GrantDeactivateEvent) Assets() []*eventstore.Asset {
return nil
}
func NewGrantDeactivateEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -244,10 +228,6 @@ func (e *GrantReactivatedEvent) UniqueConstraints() []*eventstore.EventUniqueCon
return nil
}
func (e *GrantReactivatedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewGrantReactivatedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -291,10 +271,6 @@ func (e *GrantRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstra
return []*eventstore.EventUniqueConstraint{NewRemoveProjectGrantUniqueConstraint(e.grantedOrgID, e.Aggregate().ID)}
}
func (e *GrantRemovedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewGrantRemovedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,

View File

@@ -48,10 +48,6 @@ func (e *GrantMemberAddedEvent) UniqueConstraints() []*eventstore.EventUniqueCon
return []*eventstore.EventUniqueConstraint{NewAddProjectGrantMemberUniqueConstraint(e.Aggregate().ID, e.UserID, e.GrantID)}
}
func (e *GrantMemberAddedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewProjectGrantMemberAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -100,10 +96,6 @@ func (e *GrantMemberChangedEvent) UniqueConstraints() []*eventstore.EventUniqueC
return nil
}
func (e *GrantMemberChangedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewProjectGrantMemberChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -151,10 +143,6 @@ func (e *GrantMemberRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueC
return []*eventstore.EventUniqueConstraint{NewRemoveProjectGrantMemberUniqueConstraint(e.Aggregate().ID, e.UserID, e.GrantID)}
}
func (e *GrantMemberRemovedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewProjectGrantMemberRemovedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,

View File

@@ -36,10 +36,6 @@ func (e *ApplicationKeyAddedEvent) UniqueConstraints() []*eventstore.EventUnique
return nil
}
func (e *ApplicationKeyAddedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewApplicationKeyAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -92,10 +88,6 @@ func (e *ApplicationKeyRemovedEvent) UniqueConstraints() []*eventstore.EventUniq
return nil
}
func (e *ApplicationKeyRemovedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewApplicationKeyRemovedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,

View File

@@ -49,10 +49,6 @@ func (e *OIDCConfigAddedEvent) UniqueConstraints() []*eventstore.EventUniqueCons
return nil
}
func (e *OIDCConfigAddedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewOIDCConfigAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -138,10 +134,6 @@ func (e *OIDCConfigChangedEvent) UniqueConstraints() []*eventstore.EventUniqueCo
return nil
}
func (e *OIDCConfigChangedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewOIDCConfigChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -274,10 +266,6 @@ func (e *OIDCConfigSecretChangedEvent) UniqueConstraints() []*eventstore.EventUn
return nil
}
func (e *OIDCConfigSecretChangedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewOIDCConfigSecretChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -322,10 +310,6 @@ func (e *OIDCConfigSecretCheckSucceededEvent) UniqueConstraints() []*eventstore.
return nil
}
func (e *OIDCConfigSecretCheckSucceededEvent) Assets() []*eventstore.Asset {
return nil
}
func NewOIDCConfigSecretCheckSucceededEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -368,10 +352,6 @@ func (e *OIDCConfigSecretCheckFailedEvent) UniqueConstraints() []*eventstore.Eve
return nil
}
func (e *OIDCConfigSecretCheckFailedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewOIDCConfigSecretCheckFailedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,

View File

@@ -48,10 +48,6 @@ func (e *ProjectAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstra
return []*eventstore.EventUniqueConstraint{NewAddProjectNameUniqueConstraint(e.Name, e.Aggregate().ResourceOwner)}
}
func (e *ProjectAddedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewProjectAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -103,10 +99,6 @@ func (e *ProjectChangeEvent) UniqueConstraints() []*eventstore.EventUniqueConstr
return nil
}
func (e *ProjectChangeEvent) Assets() []*eventstore.Asset {
return nil
}
func NewProjectChangeEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -175,10 +167,6 @@ func (e *ProjectDeactivatedEvent) UniqueConstraints() []*eventstore.EventUniqueC
return nil
}
func (e *ProjectDeactivatedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewProjectDeactivatedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *ProjectDeactivatedEvent {
return &ProjectDeactivatedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
@@ -207,10 +195,6 @@ func (e *ProjectReactivatedEvent) UniqueConstraints() []*eventstore.EventUniqueC
return nil
}
func (e *ProjectReactivatedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewProjectReactivatedEvent(ctx context.Context, aggregate *eventstore.Aggregate) *ProjectReactivatedEvent {
return &ProjectReactivatedEvent{
BaseEvent: *eventstore.NewBaseEventForPush(
@@ -241,10 +225,6 @@ func (e *ProjectRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConst
return []*eventstore.EventUniqueConstraint{NewRemoveProjectNameUniqueConstraint(e.Name, e.Aggregate().ResourceOwner)}
}
func (e *ProjectRemovedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewProjectRemovedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,

View File

@@ -47,10 +47,6 @@ func (e *RoleAddedEvent) UniqueConstraints() []*eventstore.EventUniqueConstraint
return []*eventstore.EventUniqueConstraint{NewAddProjectRoleUniqueConstraint(e.Key, e.Aggregate().ID)}
}
func (e *RoleAddedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewRoleAddedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -99,10 +95,6 @@ func (e *RoleChangedEvent) UniqueConstraints() []*eventstore.EventUniqueConstrai
return nil
}
func (e *RoleChangedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewRoleChangedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,
@@ -172,10 +164,6 @@ func (e *RoleRemovedEvent) UniqueConstraints() []*eventstore.EventUniqueConstrai
return []*eventstore.EventUniqueConstraint{NewRemoveProjectRoleUniqueConstraint(e.Key, e.Aggregate().ID)}
}
func (e *RoleRemovedEvent) Assets() []*eventstore.Asset {
return nil
}
func NewRoleRemovedEvent(
ctx context.Context,
aggregate *eventstore.Aggregate,