refactor: rename config structs (#5459)

This commit is contained in:
Elio Bischof
2023-03-16 18:24:30 +01:00
committed by GitHub
parent 1896f13952
commit 09abf06d4d
27 changed files with 92 additions and 92 deletions

View File

@@ -110,7 +110,7 @@ type InstanceSetup struct {
}
EmailTemplate []byte
MessageTexts []*domain.CustomMessageText
SMTPConfiguration *smtp.EmailConfig
SMTPConfiguration *smtp.Config
OIDCSettings *struct {
AccessTokenLifetime time.Duration
IdTokenLifetime time.Duration

View File

@@ -11,7 +11,7 @@ import (
"github.com/zitadel/zitadel/internal/telemetry/tracing"
)
func (c *Commands) AddDebugNotificationProviderFile(ctx context.Context, fileSystemProvider *fs.FSConfig) (*domain.ObjectDetails, error) {
func (c *Commands) AddDebugNotificationProviderFile(ctx context.Context, fileSystemProvider *fs.Config) (*domain.ObjectDetails, error) {
writeModel := NewInstanceDebugNotificationFileWriteModel(ctx)
instanceAgg := InstanceAggregateFromWriteModel(&writeModel.WriteModel)
events, err := c.addDefaultDebugNotificationFile(ctx, instanceAgg, writeModel, fileSystemProvider)
@@ -29,7 +29,7 @@ func (c *Commands) AddDebugNotificationProviderFile(ctx context.Context, fileSys
return writeModelToObjectDetails(&writeModel.DebugNotificationWriteModel.WriteModel), nil
}
func (c *Commands) addDefaultDebugNotificationFile(ctx context.Context, instanceAgg *eventstore.Aggregate, addedWriteModel *InstanceDebugNotificationFileWriteModel, fileSystemProvider *fs.FSConfig) ([]eventstore.Command, error) {
func (c *Commands) addDefaultDebugNotificationFile(ctx context.Context, instanceAgg *eventstore.Aggregate, addedWriteModel *InstanceDebugNotificationFileWriteModel, fileSystemProvider *fs.Config) ([]eventstore.Command, error) {
err := c.eventstore.FilterToQueryReducer(ctx, addedWriteModel)
if err != nil {
return nil, err
@@ -46,7 +46,7 @@ func (c *Commands) addDefaultDebugNotificationFile(ctx context.Context, instance
return events, nil
}
func (c *Commands) ChangeDefaultNotificationFile(ctx context.Context, fileSystemProvider *fs.FSConfig) (*domain.ObjectDetails, error) {
func (c *Commands) ChangeDefaultNotificationFile(ctx context.Context, fileSystemProvider *fs.Config) (*domain.ObjectDetails, error) {
writeModel := NewInstanceDebugNotificationFileWriteModel(ctx)
instanceAgg := InstanceAggregateFromWriteModel(&writeModel.WriteModel)
events, err := c.changeDefaultDebugNotificationProviderFile(ctx, instanceAgg, writeModel, fileSystemProvider)
@@ -64,7 +64,7 @@ func (c *Commands) ChangeDefaultNotificationFile(ctx context.Context, fileSystem
return writeModelToObjectDetails(&writeModel.DebugNotificationWriteModel.WriteModel), nil
}
func (c *Commands) changeDefaultDebugNotificationProviderFile(ctx context.Context, instanceAgg *eventstore.Aggregate, existingProvider *InstanceDebugNotificationFileWriteModel, fileSystemProvider *fs.FSConfig) ([]eventstore.Command, error) {
func (c *Commands) changeDefaultDebugNotificationProviderFile(ctx context.Context, instanceAgg *eventstore.Aggregate, existingProvider *InstanceDebugNotificationFileWriteModel, fileSystemProvider *fs.Config) ([]eventstore.Command, error) {
err := c.defaultDebugNotificationProviderFileWriteModelByID(ctx, existingProvider)
if err != nil {
return nil, err

View File

@@ -22,7 +22,7 @@ func TestCommandSide_AddDefaultDebugNotificationProviderFile(t *testing.T) {
}
type args struct {
ctx context.Context
provider *fs.FSConfig
provider *fs.Config
}
type res struct {
want *domain.ObjectDetails
@@ -51,7 +51,7 @@ func TestCommandSide_AddDefaultDebugNotificationProviderFile(t *testing.T) {
},
args: args{
ctx: context.Background(),
provider: &fs.FSConfig{
provider: &fs.Config{
Compact: true,
Enabled: true,
},
@@ -81,7 +81,7 @@ func TestCommandSide_AddDefaultDebugNotificationProviderFile(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
provider: &fs.FSConfig{
provider: &fs.Config{
Compact: true,
},
},
@@ -117,7 +117,7 @@ func TestCommandSide_ChangeDebugNotificationProviderFile(t *testing.T) {
}
type args struct {
ctx context.Context
provider *fs.FSConfig
provider *fs.Config
}
type res struct {
want *domain.ObjectDetails
@@ -139,7 +139,7 @@ func TestCommandSide_ChangeDebugNotificationProviderFile(t *testing.T) {
},
args: args{
ctx: context.Background(),
provider: &fs.FSConfig{
provider: &fs.Config{
Compact: true,
Enabled: true,
},
@@ -165,7 +165,7 @@ func TestCommandSide_ChangeDebugNotificationProviderFile(t *testing.T) {
},
args: args{
ctx: context.Background(),
provider: &fs.FSConfig{
provider: &fs.Config{
Compact: true,
Enabled: false,
},
@@ -191,7 +191,7 @@ func TestCommandSide_ChangeDebugNotificationProviderFile(t *testing.T) {
},
args: args{
ctx: context.Background(),
provider: &fs.FSConfig{
provider: &fs.Config{
Compact: true,
Enabled: true,
},
@@ -227,7 +227,7 @@ func TestCommandSide_ChangeDebugNotificationProviderFile(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
provider: &fs.FSConfig{
provider: &fs.Config{
Compact: false,
Enabled: false,
},

View File

@@ -11,7 +11,7 @@ import (
"github.com/zitadel/zitadel/internal/telemetry/tracing"
)
func (c *Commands) AddDebugNotificationProviderLog(ctx context.Context, fileSystemProvider *fs.FSConfig) (*domain.ObjectDetails, error) {
func (c *Commands) AddDebugNotificationProviderLog(ctx context.Context, fileSystemProvider *fs.Config) (*domain.ObjectDetails, error) {
writeModel := NewInstanceDebugNotificationLogWriteModel(ctx)
instanceAgg := InstanceAggregateFromWriteModel(&writeModel.WriteModel)
events, err := c.addDefaultDebugNotificationLog(ctx, instanceAgg, writeModel, fileSystemProvider)
@@ -29,7 +29,7 @@ func (c *Commands) AddDebugNotificationProviderLog(ctx context.Context, fileSyst
return writeModelToObjectDetails(&writeModel.DebugNotificationWriteModel.WriteModel), nil
}
func (c *Commands) addDefaultDebugNotificationLog(ctx context.Context, instanceAgg *eventstore.Aggregate, addedWriteModel *InstanceDebugNotificationLogWriteModel, fileSystemProvider *fs.FSConfig) ([]eventstore.Command, error) {
func (c *Commands) addDefaultDebugNotificationLog(ctx context.Context, instanceAgg *eventstore.Aggregate, addedWriteModel *InstanceDebugNotificationLogWriteModel, fileSystemProvider *fs.Config) ([]eventstore.Command, error) {
err := c.eventstore.FilterToQueryReducer(ctx, addedWriteModel)
if err != nil {
return nil, err
@@ -46,7 +46,7 @@ func (c *Commands) addDefaultDebugNotificationLog(ctx context.Context, instanceA
return events, nil
}
func (c *Commands) ChangeDefaultNotificationLog(ctx context.Context, fileSystemProvider *fs.FSConfig) (*domain.ObjectDetails, error) {
func (c *Commands) ChangeDefaultNotificationLog(ctx context.Context, fileSystemProvider *fs.Config) (*domain.ObjectDetails, error) {
writeModel := NewInstanceDebugNotificationLogWriteModel(ctx)
instanceAgg := InstanceAggregateFromWriteModel(&writeModel.WriteModel)
event, err := c.changeDefaultDebugNotificationProviderLog(ctx, instanceAgg, writeModel, fileSystemProvider)
@@ -64,7 +64,7 @@ func (c *Commands) ChangeDefaultNotificationLog(ctx context.Context, fileSystemP
return writeModelToObjectDetails(&writeModel.DebugNotificationWriteModel.WriteModel), nil
}
func (c *Commands) changeDefaultDebugNotificationProviderLog(ctx context.Context, instanceAgg *eventstore.Aggregate, existingProvider *InstanceDebugNotificationLogWriteModel, fileSystemProvider *fs.FSConfig) (eventstore.Command, error) {
func (c *Commands) changeDefaultDebugNotificationProviderLog(ctx context.Context, instanceAgg *eventstore.Aggregate, existingProvider *InstanceDebugNotificationLogWriteModel, fileSystemProvider *fs.Config) (eventstore.Command, error) {
err := c.defaultDebugNotificationProviderLogWriteModelByID(ctx, existingProvider)
if err != nil {
return nil, err

View File

@@ -22,7 +22,7 @@ func TestCommandSide_AddDefaultDebugNotificationProviderLog(t *testing.T) {
}
type args struct {
ctx context.Context
provider *fs.FSConfig
provider *fs.Config
}
type res struct {
want *domain.ObjectDetails
@@ -52,7 +52,7 @@ func TestCommandSide_AddDefaultDebugNotificationProviderLog(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
provider: &fs.FSConfig{
provider: &fs.Config{
Compact: true,
Enabled: true,
},
@@ -82,7 +82,7 @@ func TestCommandSide_AddDefaultDebugNotificationProviderLog(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
provider: &fs.FSConfig{
provider: &fs.Config{
Compact: true,
},
},
@@ -113,7 +113,7 @@ func TestCommandSide_AddDefaultDebugNotificationProviderLog(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
provider: &fs.FSConfig{
provider: &fs.Config{
Compact: true,
Enabled: true,
},
@@ -150,7 +150,7 @@ func TestCommandSide_ChangeDebugNotificationProviderLog(t *testing.T) {
}
type args struct {
ctx context.Context
provider *fs.FSConfig
provider *fs.Config
}
type res struct {
want *domain.ObjectDetails
@@ -172,7 +172,7 @@ func TestCommandSide_ChangeDebugNotificationProviderLog(t *testing.T) {
},
args: args{
ctx: context.Background(),
provider: &fs.FSConfig{
provider: &fs.Config{
Compact: true,
Enabled: true,
},
@@ -198,7 +198,7 @@ func TestCommandSide_ChangeDebugNotificationProviderLog(t *testing.T) {
},
args: args{
ctx: context.Background(),
provider: &fs.FSConfig{
provider: &fs.Config{
Compact: true,
Enabled: false,
},
@@ -234,7 +234,7 @@ func TestCommandSide_ChangeDebugNotificationProviderLog(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
provider: &fs.FSConfig{
provider: &fs.Config{
Compact: false,
Enabled: false,
},
@@ -271,7 +271,7 @@ func TestCommandSide_ChangeDebugNotificationProviderLog(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
provider: &fs.FSConfig{
provider: &fs.Config{
Compact: false,
Enabled: true,
},

View File

@@ -10,7 +10,7 @@ import (
"github.com/zitadel/zitadel/internal/repository/instance"
)
func (c *Commands) AddSMSConfigTwilio(ctx context.Context, instanceID string, config *twilio.TwilioConfig) (string, *domain.ObjectDetails, error) {
func (c *Commands) AddSMSConfigTwilio(ctx context.Context, instanceID string, config *twilio.Config) (string, *domain.ObjectDetails, error) {
id, err := c.idGenerator.Next()
if err != nil {
return "", nil, err
@@ -46,7 +46,7 @@ func (c *Commands) AddSMSConfigTwilio(ctx context.Context, instanceID string, co
return id, writeModelToObjectDetails(&smsConfigWriteModel.WriteModel), nil
}
func (c *Commands) ChangeSMSConfigTwilio(ctx context.Context, instanceID, id string, config *twilio.TwilioConfig) (*domain.ObjectDetails, error) {
func (c *Commands) ChangeSMSConfigTwilio(ctx context.Context, instanceID, id string, config *twilio.Config) (*domain.ObjectDetails, error) {
if id == "" {
return nil, caos_errs.ThrowInvalidArgument(nil, "SMS-e9jwf", "Errors.IDMissing")
}

View File

@@ -27,7 +27,7 @@ func TestCommandSide_AddSMSConfigTwilio(t *testing.T) {
type args struct {
ctx context.Context
instanceID string
sms *twilio.TwilioConfig
sms *twilio.Config
}
type res struct {
want *domain.ObjectDetails
@@ -70,7 +70,7 @@ func TestCommandSide_AddSMSConfigTwilio(t *testing.T) {
args: args{
ctx: context.Background(),
instanceID: "INSTANCE",
sms: &twilio.TwilioConfig{
sms: &twilio.Config{
SID: "sid",
Token: "token",
SenderNumber: "senderName",
@@ -112,7 +112,7 @@ func TestCommandSide_ChangeSMSConfigTwilio(t *testing.T) {
ctx context.Context
instanceID string
id string
sms *twilio.TwilioConfig
sms *twilio.Config
}
type res struct {
want *domain.ObjectDetails
@@ -133,7 +133,7 @@ func TestCommandSide_ChangeSMSConfigTwilio(t *testing.T) {
},
args: args{
ctx: context.Background(),
sms: &twilio.TwilioConfig{},
sms: &twilio.Config{},
},
res: res{
err: caos_errs.IsErrorInvalidArgument,
@@ -149,7 +149,7 @@ func TestCommandSide_ChangeSMSConfigTwilio(t *testing.T) {
},
args: args{
ctx: context.Background(),
sms: &twilio.TwilioConfig{},
sms: &twilio.Config{},
instanceID: "INSTANCE",
id: "id",
},
@@ -183,7 +183,7 @@ func TestCommandSide_ChangeSMSConfigTwilio(t *testing.T) {
},
args: args{
ctx: context.Background(),
sms: &twilio.TwilioConfig{
sms: &twilio.Config{
SID: "sid",
Token: "token",
SenderNumber: "senderName",
@@ -233,7 +233,7 @@ func TestCommandSide_ChangeSMSConfigTwilio(t *testing.T) {
},
args: args{
ctx: context.Background(),
sms: &twilio.TwilioConfig{
sms: &twilio.Config{
SID: "sid2",
Token: "token2",
SenderNumber: "senderName2",

View File

@@ -15,7 +15,7 @@ import (
"github.com/zitadel/zitadel/internal/repository/instance"
)
func (c *Commands) AddSMTPConfig(ctx context.Context, config *smtp.EmailConfig) (*domain.ObjectDetails, error) {
func (c *Commands) AddSMTPConfig(ctx context.Context, config *smtp.Config) (*domain.ObjectDetails, error) {
instanceAgg := instance.NewAggregate(authz.GetInstance(ctx).InstanceID())
validation := c.prepareAddSMTPConfig(instanceAgg, config.From, config.FromName, config.SMTP.Host, config.SMTP.User, []byte(config.SMTP.Password), config.Tls)
cmds, err := preparation.PrepareCommands(ctx, c.eventstore.Filter, validation)
@@ -33,7 +33,7 @@ func (c *Commands) AddSMTPConfig(ctx context.Context, config *smtp.EmailConfig)
}, nil
}
func (c *Commands) ChangeSMTPConfig(ctx context.Context, config *smtp.EmailConfig) (*domain.ObjectDetails, error) {
func (c *Commands) ChangeSMTPConfig(ctx context.Context, config *smtp.Config) (*domain.ObjectDetails, error) {
instanceAgg := instance.NewAggregate(authz.GetInstance(ctx).InstanceID())
validation := c.prepareChangeSMTPConfig(instanceAgg, config.From, config.FromName, config.SMTP.Host, config.SMTP.User, config.Tls)
cmds, err := preparation.PrepareCommands(ctx, c.eventstore.Filter, validation)

View File

@@ -24,7 +24,7 @@ func TestCommandSide_AddSMTPConfig(t *testing.T) {
}
type args struct {
ctx context.Context
smtp *smtp.EmailConfig
smtp *smtp.Config
}
type res struct {
want *domain.ObjectDetails
@@ -55,7 +55,7 @@ func TestCommandSide_AddSMTPConfig(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
smtp: &smtp.EmailConfig{
smtp: &smtp.Config{
Tls: true,
From: "from@domain.ch",
FromName: "name",
@@ -105,7 +105,7 @@ func TestCommandSide_AddSMTPConfig(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
smtp: &smtp.EmailConfig{
smtp: &smtp.Config{
Tls: true,
From: "from@domain.ch",
FromName: "name",
@@ -167,7 +167,7 @@ func TestCommandSide_AddSMTPConfig(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
smtp: &smtp.EmailConfig{
smtp: &smtp.Config{
Tls: true,
From: "from@domain.ch",
FromName: "name",
@@ -191,7 +191,7 @@ func TestCommandSide_AddSMTPConfig(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
smtp: &smtp.EmailConfig{
smtp: &smtp.Config{
Tls: true,
From: "from@domain.ch",
FromName: "name",
@@ -213,7 +213,7 @@ func TestCommandSide_AddSMTPConfig(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
smtp: &smtp.EmailConfig{
smtp: &smtp.Config{
Tls: true,
From: "from@domain.ch",
FromName: "name",
@@ -275,7 +275,7 @@ func TestCommandSide_AddSMTPConfig(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
smtp: &smtp.EmailConfig{
smtp: &smtp.Config{
Tls: true,
From: "from@domain.ch",
FromName: "name",
@@ -319,7 +319,7 @@ func TestCommandSide_ChangeSMTPConfig(t *testing.T) {
}
type args struct {
ctx context.Context
smtp *smtp.EmailConfig
smtp *smtp.Config
}
type res struct {
want *domain.ObjectDetails
@@ -340,7 +340,7 @@ func TestCommandSide_ChangeSMTPConfig(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
smtp: &smtp.EmailConfig{},
smtp: &smtp.Config{},
},
res: res{
err: caos_errs.IsErrorInvalidArgument,
@@ -356,7 +356,7 @@ func TestCommandSide_ChangeSMTPConfig(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
smtp: &smtp.EmailConfig{
smtp: &smtp.Config{
Tls: true,
From: "from@domain.ch",
FromName: "name",
@@ -406,7 +406,7 @@ func TestCommandSide_ChangeSMTPConfig(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
smtp: &smtp.EmailConfig{
smtp: &smtp.Config{
Tls: true,
From: "from@wrongdomain.ch",
FromName: "name",
@@ -456,7 +456,7 @@ func TestCommandSide_ChangeSMTPConfig(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
smtp: &smtp.EmailConfig{
smtp: &smtp.Config{
Tls: true,
From: "from@domain.ch",
FromName: "name",
@@ -521,7 +521,7 @@ func TestCommandSide_ChangeSMTPConfig(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
smtp: &smtp.EmailConfig{
smtp: &smtp.Config{
Tls: false,
From: "from2@domain.ch",
FromName: "name2",
@@ -544,7 +544,7 @@ func TestCommandSide_ChangeSMTPConfig(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
smtp: &smtp.EmailConfig{
smtp: &smtp.Config{
Tls: true,
From: "from@domain.ch",
FromName: "name",
@@ -566,7 +566,7 @@ func TestCommandSide_ChangeSMTPConfig(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
smtp: &smtp.EmailConfig{
smtp: &smtp.Config{
Tls: true,
From: "from@domain.ch",
FromName: "name",
@@ -632,7 +632,7 @@ func TestCommandSide_ChangeSMTPConfig(t *testing.T) {
},
args: args{
ctx: authz.WithInstanceID(context.Background(), "INSTANCE"),
smtp: &smtp.EmailConfig{
smtp: &smtp.Config{
Tls: false,
From: "from2@domain.ch",
FromName: "name2",