From 9a21b4cddf3b028a045d21eccd7e6d823c8b36e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Andr=C3=A9n?= Date: Mon, 19 Feb 2024 16:21:37 +0100 Subject: [PATCH] feat: Create ClusterHttpManagementRoutes with typed actor system (#1253) --- .../scaladsl/ClusterHttpManagementRoutes.scala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cluster-http/src/main/scala/akka/management/cluster/scaladsl/ClusterHttpManagementRoutes.scala b/cluster-http/src/main/scala/akka/management/cluster/scaladsl/ClusterHttpManagementRoutes.scala index 305465cec..8426c61f7 100644 --- a/cluster-http/src/main/scala/akka/management/cluster/scaladsl/ClusterHttpManagementRoutes.scala +++ b/cluster-http/src/main/scala/akka/management/cluster/scaladsl/ClusterHttpManagementRoutes.scala @@ -8,6 +8,7 @@ import akka.cluster.sharding.{ ClusterSharding, ShardRegion } import akka.cluster.{ Cluster, Member, MemberStatus } import akka.http.scaladsl.model.{ HttpMethod, HttpMethods, StatusCodes, Uri } import Uri.Path +import akka.actor.ClassicActorSystemProvider import akka.http.scaladsl.server.Route import akka.management.cluster._ import akka.pattern.ask @@ -248,6 +249,13 @@ object ClusterHttpManagementRoutes extends ClusterHttpManagementJsonProtocol { } } + /** + * Creates an instance of [[ClusterHttpManagementRoutes]] to manage the cluster for the given + * typed or classic actor system instance. This version does not provide Basic Authentication. + */ + def apply(actorySystemProvider: ClassicActorSystemProvider): Route = + apply(Cluster(actorySystemProvider.classicSystem)) + /** * Creates an instance of [[ClusterHttpManagementRoutes]] to manage the specified * [[akka.cluster.Cluster]] instance. This version does not provide Basic Authentication. @@ -291,6 +299,12 @@ object ClusterHttpManagementRoutes extends ClusterHttpManagementJsonProtocol { } } + /** + * Creates an instance of [[ClusterHttpManagementRoutes]] with only the read only routes. + */ + def readOnly(actorySystemProvider: ClassicActorSystemProvider): Route = + readOnly(Cluster(actorySystemProvider.classicSystem)) + /** * Creates an instance of [[ClusterHttpManagementRoutes]] with only the read only routes. */