Skip to content

Commit bf1050f

Browse files
committed
more strict enums
1 parent 728dc62 commit bf1050f

5 files changed

Lines changed: 32 additions & 11 deletions

File tree

src/main/kotlin/spp/cli/commands/admin/access/AddAccessPermission.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ import spp.cli.PlatformCLI
3131
import spp.cli.PlatformCLI.echoError
3232
import spp.cli.protocol.access.AddAccessPermissionMutation
3333
import spp.cli.protocol.access.adapter.AddAccessPermissionMutation_ResponseAdapter.AddAccessPermission
34-
import spp.cli.protocol.type.AccessType
3534
import spp.cli.util.JsonCleaner
35+
import spp.protocol.platform.auth.AccessType
3636
import kotlin.system.exitProcess
3737

3838
class AddAccessPermission : CliktCommand(printHelpOnEmptyArgs = true) {
@@ -43,7 +43,10 @@ class AddAccessPermission : CliktCommand(printHelpOnEmptyArgs = true) {
4343
override fun run() = runBlocking {
4444
val response = try {
4545
PlatformCLI.apolloClient.mutation(
46-
AddAccessPermissionMutation(Optional.Present(locationPatterns), type)
46+
AddAccessPermissionMutation(
47+
Optional.Present(locationPatterns),
48+
spp.cli.protocol.type.AccessType.valueOf(type.toString())
49+
)
4750
).execute()
4851
} catch (e: Exception) {
4952
echoError(e)

src/main/kotlin/spp/cli/commands/admin/permission/AddRolePermission.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import spp.cli.Main
2525
import spp.cli.PlatformCLI.apolloClient
2626
import spp.cli.PlatformCLI.echoError
2727
import spp.cli.protocol.permission.AddRolePermissionMutation
28-
import spp.cli.protocol.type.RolePermission
28+
import spp.protocol.platform.auth.RolePermission
2929
import kotlin.system.exitProcess
3030

3131
class AddRolePermission : CliktCommand(printHelpOnEmptyArgs = true) {

src/main/kotlin/spp/cli/commands/developer/instrument/AddBreakpoint.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ import spp.cli.protocol.instrument.adapter.AddLiveBreakpointMutation_ResponseAda
3636
import spp.cli.protocol.type.InstrumentThrottleInput
3737
import spp.cli.protocol.type.LiveBreakpointInput
3838
import spp.cli.protocol.type.LiveSourceLocationInput
39-
import spp.cli.protocol.type.ThrottleStep
4039
import spp.cli.util.JsonCleaner
40+
import spp.protocol.instrument.throttle.ThrottleStep
4141
import kotlin.system.exitProcess
4242

4343
class AddBreakpoint : CliktCommand(name = "breakpoint", help = "Add a live breakpoint instrument") {
@@ -57,7 +57,11 @@ class AddBreakpoint : CliktCommand(name = "breakpoint", help = "Add a live break
5757
condition = Optional.Present(condition),
5858
expiresAt = Optional.Present(expiresAt),
5959
hitLimit = Optional.Present(hitLimit),
60-
throttle = Optional.Present(InstrumentThrottleInput(throttleLimit, throttleStep))
60+
throttle = Optional.Present(
61+
InstrumentThrottleInput(
62+
throttleLimit, spp.cli.protocol.type.ThrottleStep.valueOf(throttleStep.toString())
63+
)
64+
)
6165
)
6266
val response = try {
6367
apolloClient.mutation(AddLiveBreakpointMutation(input)).execute()

src/main/kotlin/spp/cli/commands/developer/instrument/AddLog.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ import spp.cli.protocol.instrument.adapter.AddLiveLogMutation_ResponseAdapter.Ad
3737
import spp.cli.protocol.type.InstrumentThrottleInput
3838
import spp.cli.protocol.type.LiveLogInput
3939
import spp.cli.protocol.type.LiveSourceLocationInput
40-
import spp.cli.protocol.type.ThrottleStep
4140
import spp.cli.util.JsonCleaner
41+
import spp.protocol.instrument.throttle.ThrottleStep
4242
import kotlin.system.exitProcess
4343

4444
class AddLog : CliktCommand(name = "log", help = "Add a live log instrument") {
@@ -62,7 +62,11 @@ class AddLog : CliktCommand(name = "log", help = "Add a live log instrument") {
6262
condition = Optional.Present(condition),
6363
expiresAt = Optional.Present(expiresAt),
6464
hitLimit = Optional.Present(hitLimit),
65-
throttle = Optional.Present(InstrumentThrottleInput(throttleLimit, throttleStep))
65+
throttle = Optional.Present(
66+
InstrumentThrottleInput(
67+
throttleLimit, spp.cli.protocol.type.ThrottleStep.valueOf(throttleStep.toString())
68+
)
69+
)
6670
)
6771
val response = try {
6872
apolloClient.mutation(AddLiveLogMutation(input)).execute()

src/main/kotlin/spp/cli/commands/developer/instrument/AddMeter.kt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@ import spp.cli.PlatformCLI.apolloClient
3333
import spp.cli.PlatformCLI.echoError
3434
import spp.cli.protocol.instrument.AddLiveMeterMutation
3535
import spp.cli.protocol.instrument.adapter.AddLiveMeterMutation_ResponseAdapter.AddLiveMeter
36-
import spp.cli.protocol.type.*
36+
import spp.cli.protocol.type.InstrumentThrottleInput
37+
import spp.cli.protocol.type.LiveMeterInput
38+
import spp.cli.protocol.type.LiveSourceLocationInput
39+
import spp.cli.protocol.type.MetricValueInput
3740
import spp.cli.util.JsonCleaner
41+
import spp.protocol.instrument.meter.MeterType
42+
import spp.protocol.instrument.meter.MetricValueType
43+
import spp.protocol.instrument.throttle.ThrottleStep
3844
import kotlin.system.exitProcess
3945

4046
class AddMeter : CliktCommand(name = "meter", help = "Add a live meter instrument") {
@@ -55,16 +61,20 @@ class AddMeter : CliktCommand(name = "meter", help = "Add a live meter instrumen
5561
override fun run() = runBlocking {
5662
val input = LiveMeterInput(
5763
meterName = meterName,
58-
meterType = meterType,
64+
meterType = spp.cli.protocol.type.MeterType.valueOf(meterType.toString()),
5965
metricValue = MetricValueInput(
60-
valueType = valueType,
66+
valueType = spp.cli.protocol.type.MetricValueType.valueOf(valueType.toString()),
6167
value = Optional.presentIfNotNull(value)
6268
),
6369
location = LiveSourceLocationInput(source, line),
6470
condition = Optional.Present(condition),
6571
expiresAt = Optional.Present(expiresAt),
6672
hitLimit = Optional.Present(hitLimit),
67-
throttle = Optional.Present(InstrumentThrottleInput(throttleLimit, throttleStep))
73+
throttle = Optional.Present(
74+
InstrumentThrottleInput(
75+
throttleLimit, spp.cli.protocol.type.ThrottleStep.valueOf(throttleStep.toString())
76+
)
77+
)
6878
)
6979
val response = try {
7080
apolloClient.mutation(AddLiveMeterMutation(input)).execute()

0 commit comments

Comments
 (0)