Skip to content

Commit c13dd6b

Browse files
committed
remove ff, organize flags
1 parent ab0f8d1 commit c13dd6b

3 files changed

Lines changed: 29 additions & 42 deletions

File tree

app/account.go

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ const (
2828
)
2929

3030
var (
31+
// Kinesis audit log sink flags
32+
roleNameFlag = &cli.StringFlag{
33+
Name: roleNameFlagName,
34+
Usage: "The role name to use to write to the sink",
35+
Aliases: []string{"rn"},
36+
Required: true,
37+
}
38+
roleNameFlagOptional = &cli.StringFlag{
39+
Name: roleNameFlagName,
40+
Usage: "The role name to use to write to the sink",
41+
Aliases: []string{"rn"},
42+
}
3143
destinationUriFlag = &cli.StringFlag{
3244
Name: destinationUriFlagName,
3345
Usage: "The destination URI of the audit log sink",
@@ -39,6 +51,19 @@ var (
3951
Usage: "The destination URI of the audit log sink",
4052
Aliases: []string{"du"},
4153
}
54+
sinkRegionFlagRequired = &cli.StringFlag{
55+
Name: sinkRegionFlagName,
56+
Usage: "The region to use for the request",
57+
Aliases: []string{"re"},
58+
Required: true,
59+
}
60+
sinkRegionFlagOptional = &cli.StringFlag{
61+
Name: sinkRegionFlagName,
62+
Usage: "The region to use for the request",
63+
Aliases: []string{"re"},
64+
}
65+
66+
// PubSub audit log sink flags
4267
sinkServiceAccountEmailFlag = &cli.StringFlag{
4368
Name: sinkServiceAccountEmailFlagName,
4469
Usage: "The service account email to impersonate to write to the sink",
@@ -50,17 +75,6 @@ var (
5075
Usage: "The service account email to impersonate to write to the sink",
5176
Aliases: []string{"sae"},
5277
}
53-
roleNameFlag = &cli.StringFlag{
54-
Name: roleNameFlagName,
55-
Usage: "The role name to use to write to the sink",
56-
Aliases: []string{"rn"},
57-
Required: true,
58-
}
59-
roleNameFlagOptional = &cli.StringFlag{
60-
Name: roleNameFlagName,
61-
Usage: "The role name to use to write to the sink",
62-
Aliases: []string{"rn"},
63-
}
6478
topicNameFlag = &cli.StringFlag{
6579
Name: topicNameFlagName,
6680
Usage: "The topic name to write to the sink",
@@ -72,17 +86,6 @@ var (
7286
Usage: "The topic name to write to the sink",
7387
Aliases: []string{"tn"},
7488
}
75-
sinkRegionFlagRequired = &cli.StringFlag{
76-
Name: sinkRegionFlagName,
77-
Usage: "The region to use for the request",
78-
Aliases: []string{"re"},
79-
Required: true,
80-
}
81-
sinkRegionFlagOptional = &cli.StringFlag{
82-
Name: sinkRegionFlagName,
83-
Usage: "The region to use for the request",
84-
Aliases: []string{"re"},
85-
}
8689
)
8790

8891
type AccountClient struct {
@@ -867,8 +870,6 @@ func NewAccountCommand(getAccountClientFn GetAccountClientFn) (CommandOut, error
867870
kinesisAuditLogCommands,
868871
pubsubAuditLogCommands,
869872
}
870-
if IsFeatureEnabled(AuditLogSinkNewAPIFeatureFlag) {
871-
commandOut.Command.Subcommands = append(commandOut.Command.Subcommands, auditLogCommands)
872-
}
873+
commandOut.Command.Subcommands = append(commandOut.Command.Subcommands, auditLogCommands)
873874
return commandOut, nil
874875
}

app/account_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ type AccountTestSuite struct {
3838
}
3939

4040
func (s *AccountTestSuite) SetupTest() {
41-
if !IsFeatureEnabled(AuditLogSinkNewAPIFeatureFlag) {
42-
err := toggleFeature(AuditLogSinkNewAPIFeatureFlag)
43-
s.Require().NoError(err)
44-
}
45-
4641
s.mockCtrl = gomock.NewController(s.T())
4742
s.mockService = accountservicemock.NewMockAccountServiceClient(s.mockCtrl)
4843
s.mockCloudApiClient = apimock.NewMockCloudServiceClient(s.mockCtrl)

app/feature.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ import (
1111
)
1212

1313
var (
14-
GCPSinkFeatureFlag = "enable-gcp-sink"
15-
AuditLogSinkNewAPIFeatureFlag = "enable-audit-log-sink-new-api"
16-
featureflagFileName = "feature.json"
14+
GCPSinkFeatureFlag = "enable-gcp-sink"
15+
featureflagFileName = "feature.json"
1716
)
1817

19-
var supportFeatureFlags = []string{GCPSinkFeatureFlag, AuditLogSinkNewAPIFeatureFlag}
18+
var supportFeatureFlags = []string{GCPSinkFeatureFlag}
2019

2120
type FeatureFlag struct {
2221
Name string `json:"Name"`
@@ -155,14 +154,6 @@ func NewFeatureCommand() (CommandOut, error) {
155154
return nil
156155
},
157156
},
158-
{
159-
Name: "toggle-audit-log-sink-new-api",
160-
Aliases: []string{"tal"},
161-
Usage: "switch audit log sink new api on/off",
162-
Action: func(c *cli.Context) error {
163-
return toggleFeature(AuditLogSinkNewAPIFeatureFlag)
164-
},
165-
},
166157
},
167158
},
168159
}, nil

0 commit comments

Comments
 (0)