Skip to content

Commit 84b2d59

Browse files
committed
feat: client access functionality (sourceplusplus/sourceplusplus#504)
1 parent 82af7d2 commit 84b2d59

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

codegen/src/main/resources/META-INF/vertx/json-mappers.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ spp.protocol.instrument.event.LiveBreakpointHit.serializer=spp.protocol.marshall
3232
spp.protocol.instrument.event.LiveBreakpointHit.deserializer=spp.protocol.marshall.ProtocolMarshaller#deserializeLiveBreakpointHit
3333
spp.protocol.platform.auth.DeveloperRole.serializer=spp.protocol.marshall.ProtocolMarshaller#serializeDeveloperRole
3434
spp.protocol.platform.auth.DeveloperRole.deserializer=spp.protocol.marshall.ProtocolMarshaller#deserializeDeveloperRole
35+
spp.protocol.platform.auth.ClientAccess.serializer=spp.protocol.marshall.ProtocolMarshaller#serializeClientAccess
36+
spp.protocol.platform.auth.ClientAccess.deserializer=spp.protocol.marshall.ProtocolMarshaller#deserializeClientAccess

src/jvmMain/kotlin/spp/protocol/SourceServices.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ object SourceServices {
4545
}
4646

4747
object Utilize {
48+
const val LIVE_MANAGEMENT_SERVICE = "spp.service.live-management-service"
4849
const val LIVE_SERVICE = "spp.service.live-service"
4950
const val LIVE_INSTRUMENT = "spp.service.live-instrument"
5051
const val LIVE_VIEW = "spp.service.live-view"

src/jvmMain/kotlin/spp/protocol/marshall/ProtocolMarshaller.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import spp.protocol.instrument.event.LiveBreakpointHit
3838
import spp.protocol.instrument.event.LiveInstrumentRemoved
3939
import spp.protocol.instrument.event.LiveLogHit
4040
import spp.protocol.instrument.variable.LiveVariable
41+
import spp.protocol.platform.auth.ClientAccess
4142
import spp.protocol.platform.auth.DataRedaction
4243
import spp.protocol.platform.auth.DeveloperRole
4344
import spp.protocol.platform.auth.RedactionType
@@ -438,4 +439,17 @@ object ProtocolMarshaller {
438439
value.getBoolean("nativeRole")
439440
)
440441
}
442+
443+
@JvmStatic
444+
fun serializeClientAccess(value: ClientAccess): JsonObject {
445+
return JsonObject(Json.encode(value))
446+
}
447+
448+
@JvmStatic
449+
fun deserializeClientAccess(value: JsonObject): ClientAccess {
450+
return ClientAccess(
451+
value.getString("id"),
452+
value.getString("secret")
453+
)
454+
}
441455
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package spp.protocol.service
2+
3+
import io.vertx.codegen.annotations.GenIgnore
4+
import io.vertx.codegen.annotations.ProxyGen
5+
import io.vertx.codegen.annotations.VertxGen
6+
import io.vertx.core.Future
7+
import io.vertx.core.Vertx
8+
import io.vertx.core.eventbus.DeliveryOptions
9+
import spp.protocol.SourceServices.Utilize.LIVE_MANAGEMENT_SERVICE
10+
import spp.protocol.platform.auth.ClientAccess
11+
12+
13+
/**
14+
* todo: description.
15+
*
16+
* @author [Brandon Fergerson](mailto:bfergerson@apache.org)
17+
*/
18+
@ProxyGen
19+
@VertxGen
20+
interface LiveManagementService {
21+
22+
@GenIgnore
23+
companion object {
24+
@JvmStatic
25+
fun createProxy(vertx: Vertx, authToken: String? = null): LiveManagementService {
26+
val deliveryOptions = DeliveryOptions().apply {
27+
authToken?.let { addHeader("auth-token", it) }
28+
}
29+
return LiveManagementServiceVertxEBProxy(vertx, LIVE_MANAGEMENT_SERVICE, deliveryOptions)
30+
}
31+
}
32+
33+
fun getClientAccessors(): Future<List<ClientAccess>>
34+
fun getClientAccess(id: String): Future<ClientAccess?>
35+
fun addClientAccess(): Future<ClientAccess>
36+
fun removeClientAccess(id: String): Future<Boolean>
37+
fun updateClientAccess(id: String): Future<ClientAccess>
38+
}

0 commit comments

Comments
 (0)