mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mp...@apache.org
Subject mesos git commit: Added port mappings in `NetworkInfo` as part of `state` endpoints.
Date Fri, 25 Aug 2017 21:34:00 GMT
Repository: mesos
Updated Branches:
  refs/heads/master 53a79b229 -> bfd3fa7a6


Added port mappings in `NetworkInfo` as part of `state` endpoints.

Review: https://reviews.apache.org/r/61866/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/bfd3fa7a
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/bfd3fa7a
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/bfd3fa7a

Branch: refs/heads/master
Commit: bfd3fa7a636943be0dd9265896dae30401cb8b95
Parents: 53a79b2
Author: Deepak Goel <deepak.goel9@gmail.com>
Authored: Thu Aug 24 16:32:40 2017 -0700
Committer: Michael Park <mpark@apache.org>
Committed: Fri Aug 25 13:23:33 2017 -0700

----------------------------------------------------------------------
 src/common/http.cpp | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/bfd3fa7a/src/common/http.cpp
----------------------------------------------------------------------
diff --git a/src/common/http.cpp b/src/common/http.cpp
index 43d674e..226fed4 100644
--- a/src/common/http.cpp
+++ b/src/common/http.cpp
@@ -270,6 +270,16 @@ JSON::Object model(const NetworkInfo& info)
     object.values["name"] = info.name();
   }
 
+  if (info.port_mappings().size() > 0) {
+    JSON::Array array;
+    array.values.reserve(info.port_mappings().size()); // MESOS-2353
+    foreach (const NetworkInfo::PortMapping& portMapping,
+             info.port_mappings()) {
+      array.values.push_back(JSON::protobuf(portMapping));
+    }
+    object.values["port_mappings"] = std::move(array);
+  }
+
   return object;
 }
 
@@ -630,6 +640,15 @@ static void json(JSON::ObjectWriter* writer, const NetworkInfo& info)
   if (info.has_name()) {
     writer->field("name", info.name());
   }
+
+  if (info.port_mappings().size() > 0) {
+    writer->field("port_mappings", [&info](JSON::ArrayWriter* writer) {
+      foreach(const NetworkInfo::PortMapping& portMapping,
+              info.port_mappings()) {
+        writer->element(JSON::Protobuf(portMapping));
+      }
+    });
+  }
 }
 
 


Mime
View raw message