Ejemplo n.º 1
0
 public async Task<IActionResult> PutHost([FromBody]Host host) {
     //DefaultModelBinder x;
     //var result = JsonConvert.DeserializeObject<Host>(this.Request.ToString());
     // Debug.Assert(host != null, "host object is null or empty");
     var h = new Host() { Name = "test", Port = 2375 };
     await actor.PutHost(host);
     return Ok();
 }
Ejemplo n.º 2
0
        private Container Convert(ContainerListResource containerResource, Host host)
        {
            var container = new Container();
            container.HostName = host.Name;
            container.HostId = host.Id;
            container.Id = containerResource.Id;

            // Remove the initial '/' returned in the name by Docker. Then find the first name with no '/' as this indicates a link name.
            container.Name = containerResource.Names.Select(name => name.Substring(1)).FirstOrDefault(name => !name.Contains('/'));
            container.State = containerResource.Status.StartsWith("Up") ? "Running" : "Stopped";

            string image, repository, imageTag;
            ExtractImageInfo(containerResource.Image, out image, out repository, out imageTag);

            container.Image = image;
            container.Repository = repository;
            container.ImageTag = imageTag;
            container.ComposeGroup = GetContainerComposeGroup(host.HostUrl, containerResource.Id);

            return container;
        }