Exemple #1
0
        public async Task <Object> Get(string tenantName)
        {
            try
            {
                ActorId actorId            = new ActorId(tenantName);
                ITenantWorkflowActor actor = ActorProxy.Create <ITenantWorkflowActor>(actorId, TenantHelpers.GetWorkflowActorUri());
                var status = await actor.GetStatus();

                return(Ok(status));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Exemple #2
0
        public async Task <Object> Get()
        {
            var applicationList = await fabricClient.QueryManager.GetApplicationPagedListAsync(new ApplicationQueryDescription()
            {
                ApplicationTypeNameFilter = "mcType"
            });

            var tenants = applicationList
                          .Select(x => new
            {
                Name      = x.ApplicationName,
                Status    = x.ApplicationStatus,
                Version   = x.ApplicationTypeVersion,
                Health    = x.HealthState,
                Endpoints = new Dictionary <string, string>(),
                Services  = new List <Service>()
            }).ToList();

            foreach (var tenant in tenants)
            {
                var tenantName = tenant.Name.ToString().GetName();

                ActorId actorId            = new ActorId(tenantName);
                ITenantWorkflowActor actor = ActorProxy.Create <ITenantWorkflowActor>(actorId, TenantHelpers.GetWorkflowActorUri());
                var status = await actor.GetStatus();

                if (!string.IsNullOrEmpty(status.InternalIp) && !String.IsNullOrEmpty(status.RconEndpoint))
                {
                    // ports on external ip will be same as the internal as it is configured now.
                    var mcEndpoint   = new Uri(status.InternalIp);
                    var rconEndpoint = new Uri(status.RconEndpoint);

                    tenant.Endpoints.Add("minecraft", $"{status.ExternalEndPoint}:{mcEndpoint.Port}");
                    tenant.Endpoints.Add("rcon", $"{status.ExternalEndPoint}:{rconEndpoint.Port}");
                }
            }

            return(tenants);
        }