Adding Agents Extensions to Networking
Change-Id: I862278d9d8d4e07caee464aace6537b27b9f2a47
diff --git a/openstack/networking/v2/extensions/agents/requests.go b/openstack/networking/v2/extensions/agents/requests.go
new file mode 100644
index 0000000..5c6433e
--- /dev/null
+++ b/openstack/networking/v2/extensions/agents/requests.go
@@ -0,0 +1,13 @@
+package agents
+
+import (
+ gophercloud "gerrit.mcp.mirantis.net/debian/gophercloud.git"
+ "gerrit.mcp.mirantis.net/debian/gophercloud.git/pagination"
+)
+
+func List(c *gophercloud.ServiceClient) pagination.Pager {
+ u := listURL(c)
+ return pagination.NewPager(c, u, func(r pagination.PageResult) pagination.Page {
+ return AgentPage{pagination.LinkedPageBase{PageResult: r}}
+ })
+}
diff --git a/openstack/networking/v2/extensions/agents/results.go b/openstack/networking/v2/extensions/agents/results.go
new file mode 100644
index 0000000..3ed1487
--- /dev/null
+++ b/openstack/networking/v2/extensions/agents/results.go
@@ -0,0 +1,23 @@
+package agents
+
+import "gerrit.mcp.mirantis.net/debian/gophercloud.git/pagination"
+
+type Agent struct {
+ Host string `json:"host"`
+ Service string `json:"service"`
+ AvailabilityZone string `json:"availability_zone"`
+ AdminStateUp string `json:"admin_state_up"`
+ Alive bool `json:"alive"`
+}
+
+type AgentPage struct {
+ pagination.LinkedPageBase
+}
+
+func ExtractAgents(r pagination.Page) ([]Agent, error) {
+ var s struct {
+ Agents []Agent `json:"agents"`
+ }
+ err := (r.(AgentPage)).ExtractInto(&s)
+ return s.Agents, err
+}
diff --git a/openstack/networking/v2/extensions/agents/urls.go b/openstack/networking/v2/extensions/agents/urls.go
new file mode 100644
index 0000000..e4fac8d
--- /dev/null
+++ b/openstack/networking/v2/extensions/agents/urls.go
@@ -0,0 +1,7 @@
+package agents
+
+import gophercloud "gerrit.mcp.mirantis.net/debian/gophercloud.git"
+
+func listURL(c *gophercloud.ServiceClient) string {
+ return c.ServiceURL("agents")
+}