Skip to content

Commit

Permalink
refactor: standardize environmentId naming to environmentID
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubisoft-potato committed Jan 17, 2025
1 parent cc9aa26 commit 046d6db
Show file tree
Hide file tree
Showing 17 changed files with 194 additions and 194 deletions.
8 changes: 4 additions & 4 deletions hack/create-account/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type command struct {
webGatewayAddress *string
email *string
role *string
environmentId *string
environmentID *string
organizationID *string
}

Expand All @@ -50,7 +50,7 @@ func registerCommand(r cli.CommandRegistry, p cli.ParentCommand) *command {
webGatewayAddress: cmd.Flag("web-gateway", "Address of web-gateway.").Required().String(),
email: cmd.Flag("email", "The email of an account.").Required().String(),
role: cmd.Flag("role", "The role of an environment.").Required().Enum("VIEWER", "EDITOR"),
environmentId: cmd.Flag(
environmentID: cmd.Flag(
"environment-id",
"The environment id for Datestore namespace",
).Required().String(),
Expand All @@ -74,7 +74,7 @@ func (c *command) Run(ctx context.Context, metrics metrics.Metrics, logger *zap.
err = c.createAccount(ctx, client, accountproto.AccountV2_Role_Environment(role))
if err != nil {
logger.Error("Failed to create account", zap.Error(err),
zap.String("environmentId", *c.environmentId))
zap.String("environmentId", *c.environmentID))
return err
}
logger.Info("Account created")
Expand All @@ -88,7 +88,7 @@ func (c *command) createAccount(
) error {
envRoles := []*accountproto.AccountV2_EnvironmentRole{
{
EnvironmentId: *c.environmentId,
EnvironmentId: *c.environmentID,
Role: role,
},
}
Expand Down
6 changes: 3 additions & 3 deletions hack/create-api-key/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type command struct {
name *string
role *string
output *string
environmentId *string
environmentID *string
}

func registerCommand(r cli.CommandRegistry, p cli.ParentCommand) *command {
Expand All @@ -52,7 +52,7 @@ func registerCommand(r cli.CommandRegistry, p cli.ParentCommand) *command {
role: cmd.Flag(
"role", "The role of key.").Default("SDK_CLIENT").Enum("UNKNOWN", "SDK_CLIENT", "SDK_SERVER"),
output: cmd.Flag("output", "Path of file to write api key.").Required().String(),
environmentId: cmd.Flag(
environmentID: cmd.Flag(
"environment-id",
"The environment id to store api key",
).Required().String(),
Expand All @@ -77,7 +77,7 @@ func (c *command) Run(ctx context.Context, metrics metrics.Metrics, logger *zap.
Name: *c.name,
Role: accountproto.APIKey_Role(role),
},
EnvironmentId: *c.environmentId,
EnvironmentId: *c.environmentID,
})
if err != nil {
logger.Error("Failed to create api key", zap.Error(err))
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/account/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var (
gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port")
gatewayCert = flag.String("gateway-cert", "", "Gateway crt file")
serviceTokenPath = flag.String("service-token", "", "Service token path")
environmentId = flag.String("environment-id", "", "Environment id")
environmentID = flag.String("environment-id", "", "Environment id")
organizationID = flag.String("organization-id", "", "Organization ID")
testID = flag.String("test-id", "", "test ID")
)
Expand Down
34 changes: 17 additions & 17 deletions test/e2e/autoops/auto_ops_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ var (
gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port")
gatewayCert = flag.String("gateway-cert", "", "Gateway crt file")
serviceTokenPath = flag.String("service-token", "", "Service token path")
environmentId = flag.String("environment-id", "", "Environment id")
environmentID = flag.String("environment-id", "", "Environment id")
organizationID = flag.String("organization-id", "", "Organization ID")
testID = flag.String("test-id", "", "test ID")
)
Expand Down Expand Up @@ -300,7 +300,7 @@ func TestDeleteAutoOpsRule(t *testing.T) {
}
deleteAutoOpsRules(t, autoOpsClient, autoOpsRules[0].Id)
resp, err := autoOpsClient.GetAutoOpsRule(ctx, &autoopsproto.GetAutoOpsRuleRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
Id: autoOpsRules[0].Id,
})
if resp != nil {
Expand Down Expand Up @@ -337,7 +337,7 @@ func TestUpdateAutoOpsRule(t *testing.T) {
}
updateAutoOpsRules(t, autoOpsClient, autoOpsRules[0].Id, &addClause)
resp, err := autoOpsClient.GetAutoOpsRule(ctx, &autoopsproto.GetAutoOpsRuleRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
Id: autoOpsRules[0].Id,
})
if resp == nil {
Expand Down Expand Up @@ -383,7 +383,7 @@ func TestExecuteAutoOpsRule(t *testing.T) {
t.Fatal("not enough rules")
}
_, err := autoOpsClient.ExecuteAutoOps(ctx, &autoopsproto.ExecuteAutoOpsRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
Id: autoOpsRules[0].Id,
ExecuteAutoOpsRuleCommand: &autoopsproto.ExecuteAutoOpsRuleCommand{
ClauseId: autoOpsRules[0].Clauses[0].Id,
Expand Down Expand Up @@ -422,7 +422,7 @@ func TestExecuteAutoOpsRuleForMultiSchedule(t *testing.T) {
t.Fatal("not enough rules")
}
_, err := autoOpsClient.ExecuteAutoOps(ctx, &autoopsproto.ExecuteAutoOpsRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
Id: autoOpsRules[0].Id,
ExecuteAutoOpsRuleCommand: &autoopsproto.ExecuteAutoOpsRuleCommand{
ClauseId: autoOpsRules[0].Clauses[0].Id,
Expand Down Expand Up @@ -768,7 +768,7 @@ func createGoal(ctx context.Context, t *testing.T, client experimentclient.Clien
}
_, err := client.CreateGoal(ctx, &experimentproto.CreateGoalRequest{
Command: cmd,
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
})
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -829,7 +829,7 @@ func createAutoOpsRule(
DatetimeClauses: dcs,
}
_, err := client.CreateAutoOpsRule(ctx, &autoopsproto.CreateAutoOpsRuleRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
Command: cmd,
})
if err != nil {
Expand Down Expand Up @@ -899,7 +899,7 @@ func createFeature(ctx context.Context, t *testing.T, client featureclient.Clien
cmd := newCreateFeatureCommand(featureID)
createReq := &featureproto.CreateFeatureRequest{
Command: cmd,
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
}
if _, err := client.CreateFeature(ctx, createReq); err != nil {
t.Fatal(err)
Expand All @@ -912,7 +912,7 @@ func createDisabledFeature(ctx context.Context, t *testing.T, client featureclie
cmd := newCreateFeatureCommand(featureID)
createReq := &featureproto.CreateFeatureRequest{
Command: cmd,
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
}
if _, err := client.CreateFeature(ctx, createReq); err != nil {
t.Fatal(err)
Expand All @@ -923,7 +923,7 @@ func getFeature(t *testing.T, client featureclient.Client, featureID string) *fe
t.Helper()
getReq := &featureproto.GetFeatureRequest{
Id: featureID,
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
Expand Down Expand Up @@ -985,7 +985,7 @@ func enableFeature(t *testing.T, featureID string, client featureclient.Client)
enableReq := &featureproto.EnableFeatureRequest{
Id: featureID,
Command: &featureproto.EnableFeatureCommand{},
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
}
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
Expand All @@ -999,7 +999,7 @@ func listAutoOpsRulesByFeatureID(t *testing.T, client autoopsclient.Client, feat
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
resp, err := client.ListAutoOpsRules(ctx, &autoopsproto.ListAutoOpsRulesRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
PageSize: int64(500),
FeatureIds: []string{featureID},
})
Expand All @@ -1016,7 +1016,7 @@ func getAutoOpsRules(t *testing.T, id string) *autoopsproto.AutoOpsRule {
c := newAutoOpsClient(t)
defer c.Close()
resp, err := c.GetAutoOpsRule(ctx, &autoopsproto.GetAutoOpsRuleRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
Id: id,
})
if err != nil {
Expand All @@ -1030,7 +1030,7 @@ func deleteAutoOpsRules(t *testing.T, client autoopsclient.Client, id string) {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
_, err := client.DeleteAutoOpsRule(ctx, &autoopsproto.DeleteAutoOpsRuleRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
Id: id,
Command: &autoopsproto.DeleteAutoOpsRuleCommand{},
})
Expand Down Expand Up @@ -1058,7 +1058,7 @@ func TestStopAutoOpsRule(t *testing.T) {
}
stopAutoOpsRule(t, autoOpsClient, autoOpsRules[0].Id)
resp, err := autoOpsClient.GetAutoOpsRule(ctx, &autoopsproto.GetAutoOpsRuleRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
Id: autoOpsRules[0].Id,
})
if resp == nil {
Expand All @@ -1075,7 +1075,7 @@ func stopAutoOpsRule(t *testing.T, client autoopsclient.Client, id string) {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
_, err := client.StopAutoOpsRule(ctx, &autoopsproto.StopAutoOpsRuleRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
Id: id,
Command: &autoopsproto.StopAutoOpsRuleCommand{},
})
Expand All @@ -1089,7 +1089,7 @@ func updateAutoOpsRules(t *testing.T, client autoopsclient.Client, id string, da
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
_, err := client.UpdateAutoOpsRule(ctx, &autoopsproto.UpdateAutoOpsRuleRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
Id: id,
AddDatetimeClauseCommands: []*autoopsproto.AddDatetimeClauseCommand{
{DatetimeClause: dateClause},
Expand Down
16 changes: 8 additions & 8 deletions test/e2e/autoops/progressive_rollout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func TestStopProgressiveRollout(t *testing.T) {
}
stopProgressiveRollout(t, autoOpsClient, progressiveRollouts[0].Id)
resp, err := autoOpsClient.GetProgressiveRollout(ctx, &autoopsproto.GetProgressiveRolloutRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
Id: progressiveRollouts[0].Id,
})
assert.NoError(t, err)
Expand Down Expand Up @@ -196,7 +196,7 @@ func TestDeleteProgressiveRollout(t *testing.T) {
}
deleteProgressiveRollout(t, autoOpsClient, progressiveRollouts[0].Id)
resp, err := autoOpsClient.GetProgressiveRollout(ctx, &autoopsproto.GetProgressiveRolloutRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
Id: progressiveRollouts[0].Id,
})
if resp != nil {
Expand Down Expand Up @@ -240,7 +240,7 @@ func TestExecuteProgressiveRollout(t *testing.T) {
}
clause := unmarshalProgressiveRolloutManualClause(t, progressiveRollouts[0].Clause)
_, err := autoOpsClient.ExecuteProgressiveRollout(ctx, &autoopsproto.ExecuteProgressiveRolloutRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
Id: progressiveRollouts[0].Id,
ChangeProgressiveRolloutTriggeredAtCommand: &autoopsproto.ChangeProgressiveRolloutScheduleTriggeredAtCommand{
ScheduleId: clause.Schedules[0].ScheduleId,
Expand Down Expand Up @@ -374,7 +374,7 @@ func createProgressiveRollout(
ProgressiveRolloutTemplateScheduleClause: template,
}
_, err := client.CreateProgressiveRollout(ctx, &autoopsproto.CreateProgressiveRolloutRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
Command: cmd,
})
if err != nil {
Expand All @@ -387,7 +387,7 @@ func listProgressiveRollouts(t *testing.T, client autoopsclient.Client, featureI
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
resp, err := client.ListProgressiveRollouts(ctx, &autoopsproto.ListProgressiveRolloutsRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
PageSize: 0,
FeatureIds: []string{featureID},
})
Expand Down Expand Up @@ -430,7 +430,7 @@ func getProgressiveRollout(t *testing.T, id string) *autoopsproto.ProgressiveRol
c := newAutoOpsClient(t)
defer c.Close()
resp, err := c.GetProgressiveRollout(ctx, &autoopsproto.GetProgressiveRolloutRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
Id: id,
})
if err != nil {
Expand All @@ -444,7 +444,7 @@ func stopProgressiveRollout(t *testing.T, client autoopsclient.Client, id string
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
_, err := client.StopProgressiveRollout(ctx, &autoopsproto.StopProgressiveRolloutRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
Id: id,
Command: &autoopsproto.StopProgressiveRolloutCommand{
StoppedBy: autoopsproto.ProgressiveRollout_USER,
Expand All @@ -460,7 +460,7 @@ func deleteProgressiveRollout(t *testing.T, client autoopsclient.Client, id stri
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
_, err := client.DeleteProgressiveRollout(ctx, &autoopsproto.DeleteProgressiveRolloutRequest{
EnvironmentId: *environmentId,
EnvironmentId: *environmentID,
Id: id,
Command: &autoopsproto.DeleteProgressiveRolloutCommand{},
})
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/environment/environment_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var (
gatewayPort = flag.Int("gateway-port", 443, "Gateway endpoint port")
gatewayCert = flag.String("gateway-cert", "", "Gateway crt file")
serviceTokenPath = flag.String("service-token", "", "Service token path")
environmentId = flag.String("environment-id", "", "Environment id")
environmentID = flag.String("environment-id", "", "Environment id")
organizationID = flag.String("organization-id", "", "Organization ID")
testID = flag.String("test-id", "", "test ID")
)
Expand Down Expand Up @@ -135,10 +135,10 @@ func TestUpdateEnvironmentV2(t *testing.T) {

func getEnvironmentID(t *testing.T) string {
t.Helper()
if *environmentId == "" {
if *environmentID == "" {
return "production"
}
return *environmentId
return *environmentID
}

func newEnvironmentClient(t *testing.T) environmentclient.Client {
Expand Down
Loading

0 comments on commit 046d6db

Please sign in to comment.