diff --git a/client/interfaces.go b/client/interfaces.go index 17bee965e66..5dfb7bd3bb2 100644 --- a/client/interfaces.go +++ b/client/interfaces.go @@ -60,8 +60,8 @@ type SlotRef struct { Name string `json:"slot"` } -// Interfaces contains information about all plugs, slots and their connections -type Interfaces struct { +// Connections contains information about all plugs, slots and their connections +type Connections struct { Plugs []Plug `json:"plugs"` Slots []Slot `json:"slots"` } @@ -83,10 +83,10 @@ type InterfaceAction struct { } // Connections returns all plugs, slots and their connections. -func (client *Client) Connections() (Interfaces, error) { - var ifaces Interfaces - _, err := client.doSync("GET", "/v2/interfaces", nil, nil, nil, &ifaces) - return ifaces, err +func (client *Client) Connections() (Connections, error) { + var conns Connections + _, err := client.doSync("GET", "/v2/interfaces", nil, nil, nil, &conns) + return conns, err } // InterfaceOptions represents opt-in elements include in responses. diff --git a/client/interfaces_test.go b/client/interfaces_test.go index dfa2c69eecc..38b7d2755be 100644 --- a/client/interfaces_test.go +++ b/client/interfaces_test.go @@ -190,9 +190,9 @@ func (cs *clientSuite) TestClientConnections(c *check.C) { ] } }` - interfaces, err := cs.cli.Connections() + conns, err := cs.cli.Connections() c.Assert(err, check.IsNil) - c.Check(interfaces, check.DeepEquals, client.Interfaces{ + c.Check(conns, check.DeepEquals, client.Connections{ Plugs: []client.Plug{ { Snap: "canonical-pi2", diff --git a/cmd/snap/cmd_connect_test.go b/cmd/snap/cmd_connect_test.go index b5bc84910df..463dfb14bd4 100644 --- a/cmd/snap/cmd_connect_test.go +++ b/cmd/snap/cmd_connect_test.go @@ -196,7 +196,7 @@ func (s *SnapSuite) TestConnectImplicitPlugImplicitSlot(c *C) { c.Assert(rest, DeepEquals, []string{}) } -var fortestingInterfaceList = client.Interfaces{ +var fortestingConnectionList = client.Connections{ Slots: []client.Slot{ { Snap: "core", @@ -284,7 +284,7 @@ func (s *SnapSuite) TestConnectCompletion(c *C) { c.Assert(r.Method, Equals, "GET") EncodeResponseBody(c, w, map[string]interface{}{ "type": "sync", - "result": fortestingInterfaceList, + "result": fortestingConnectionList, }) default: c.Fatalf("unexpected path %q", r.URL.Path) diff --git a/cmd/snap/cmd_disconnect_test.go b/cmd/snap/cmd_disconnect_test.go index 7a7e088df3f..31ffe1ffd01 100644 --- a/cmd/snap/cmd_disconnect_test.go +++ b/cmd/snap/cmd_disconnect_test.go @@ -180,7 +180,7 @@ func (s *SnapSuite) TestDisconnectCompletion(c *C) { c.Assert(r.Method, Equals, "GET") EncodeResponseBody(c, w, map[string]interface{}{ "type": "sync", - "result": fortestingInterfaceList, + "result": fortestingConnectionList, }) default: c.Fatalf("unexpected path %q", r.URL.Path) diff --git a/cmd/snap/cmd_interfaces_test.go b/cmd/snap/cmd_interfaces_test.go index b8cb6407d07..64bdf675de7 100644 --- a/cmd/snap/cmd_interfaces_test.go +++ b/cmd/snap/cmd_interfaces_test.go @@ -31,7 +31,7 @@ import ( . "github.com/snapcore/snapd/cmd/snap" ) -func (s *SnapSuite) TestInterfacesHelp(c *C) { +func (s *SnapSuite) TestConnectionsHelp(c *C) { msg := `Usage: snap.test [OPTIONS] interfaces [interfaces-OPTIONS] [:] @@ -70,7 +70,7 @@ Help Options: c.Assert(rest, DeepEquals, []string{}) } -func (s *SnapSuite) TestInterfacesZeroSlotsOnePlug(c *C) { +func (s *SnapSuite) TestConnectionsZeroSlotsOnePlug(c *C) { s.RedirectClientToTestServer(func(w http.ResponseWriter, r *http.Request) { c.Check(r.Method, Equals, "GET") c.Check(r.URL.Path, Equals, "/v2/interfaces") @@ -79,7 +79,7 @@ func (s *SnapSuite) TestInterfacesZeroSlotsOnePlug(c *C) { c.Check(body, DeepEquals, []byte{}) EncodeResponseBody(c, w, map[string]interface{}{ "type": "sync", - "result": client.Interfaces{ + "result": client.Connections{ Plugs: []client.Plug{ { Snap: "keyboard-lights", @@ -99,7 +99,7 @@ func (s *SnapSuite) TestInterfacesZeroSlotsOnePlug(c *C) { c.Assert(s.Stderr(), Equals, "") } -func (s *SnapSuite) TestInterfacesZeroPlugsOneSlot(c *C) { +func (s *SnapSuite) TestConnectionsZeroPlugsOneSlot(c *C) { s.RedirectClientToTestServer(func(w http.ResponseWriter, r *http.Request) { c.Check(r.Method, Equals, "GET") c.Check(r.URL.Path, Equals, "/v2/interfaces") @@ -108,7 +108,7 @@ func (s *SnapSuite) TestInterfacesZeroPlugsOneSlot(c *C) { c.Check(body, DeepEquals, []byte{}) EncodeResponseBody(c, w, map[string]interface{}{ "type": "sync", - "result": client.Interfaces{ + "result": client.Connections{ Slots: []client.Slot{ { Snap: "canonical-pi2", @@ -130,7 +130,7 @@ func (s *SnapSuite) TestInterfacesZeroPlugsOneSlot(c *C) { c.Assert(s.Stderr(), Equals, "") } -func (s *SnapSuite) TestInterfacesOneSlotOnePlug(c *C) { +func (s *SnapSuite) TestConnectionsOneSlotOnePlug(c *C) { s.RedirectClientToTestServer(func(w http.ResponseWriter, r *http.Request) { c.Check(r.Method, Equals, "GET") c.Check(r.URL.Path, Equals, "/v2/interfaces") @@ -139,7 +139,7 @@ func (s *SnapSuite) TestInterfacesOneSlotOnePlug(c *C) { c.Check(body, DeepEquals, []byte{}) EncodeResponseBody(c, w, map[string]interface{}{ "type": "sync", - "result": client.Interfaces{ + "result": client.Connections{ Slots: []client.Slot{ { Snap: "canonical-pi2", @@ -197,7 +197,7 @@ func (s *SnapSuite) TestInterfacesOneSlotOnePlug(c *C) { c.Assert(s.Stderr(), Equals, "") } -func (s *SnapSuite) TestInterfacesTwoPlugs(c *C) { +func (s *SnapSuite) TestConnectionsTwoPlugs(c *C) { s.RedirectClientToTestServer(func(w http.ResponseWriter, r *http.Request) { c.Check(r.Method, Equals, "GET") c.Check(r.URL.Path, Equals, "/v2/interfaces") @@ -206,7 +206,7 @@ func (s *SnapSuite) TestInterfacesTwoPlugs(c *C) { c.Check(body, DeepEquals, []byte{}) EncodeResponseBody(c, w, map[string]interface{}{ "type": "sync", - "result": client.Interfaces{ + "result": client.Connections{ Slots: []client.Slot{ { Snap: "canonical-pi2", @@ -238,7 +238,7 @@ func (s *SnapSuite) TestInterfacesTwoPlugs(c *C) { c.Assert(s.Stderr(), Equals, "") } -func (s *SnapSuite) TestInterfacesPlugsWithCommonName(c *C) { +func (s *SnapSuite) TestConnectionsPlugsWithCommonName(c *C) { s.RedirectClientToTestServer(func(w http.ResponseWriter, r *http.Request) { c.Check(r.Method, Equals, "GET") c.Check(r.URL.Path, Equals, "/v2/interfaces") @@ -247,7 +247,7 @@ func (s *SnapSuite) TestInterfacesPlugsWithCommonName(c *C) { c.Check(body, DeepEquals, []byte{}) EncodeResponseBody(c, w, map[string]interface{}{ "type": "sync", - "result": client.Interfaces{ + "result": client.Connections{ Slots: []client.Slot{ { Snap: "canonical-pi2", @@ -305,7 +305,7 @@ func (s *SnapSuite) TestInterfacesPlugsWithCommonName(c *C) { c.Assert(s.Stderr(), Equals, "") } -func (s *SnapSuite) TestInterfacesOsSnapSlots(c *C) { +func (s *SnapSuite) TestConnectionsOsSnapSlots(c *C) { s.RedirectClientToTestServer(func(w http.ResponseWriter, r *http.Request) { c.Check(r.Method, Equals, "GET") c.Check(r.URL.Path, Equals, "/v2/interfaces") @@ -314,7 +314,7 @@ func (s *SnapSuite) TestInterfacesOsSnapSlots(c *C) { c.Check(body, DeepEquals, []byte{}) EncodeResponseBody(c, w, map[string]interface{}{ "type": "sync", - "result": client.Interfaces{ + "result": client.Connections{ Slots: []client.Slot{ { Snap: "core", @@ -372,7 +372,7 @@ func (s *SnapSuite) TestInterfacesOsSnapSlots(c *C) { c.Assert(s.Stderr(), Equals, "") } -func (s *SnapSuite) TestInterfacesTwoSlotsAndFiltering(c *C) { +func (s *SnapSuite) TestConnectionsTwoSlotsAndFiltering(c *C) { s.RedirectClientToTestServer(func(w http.ResponseWriter, r *http.Request) { c.Check(r.Method, Equals, "GET") c.Check(r.URL.Path, Equals, "/v2/interfaces") @@ -381,7 +381,7 @@ func (s *SnapSuite) TestInterfacesTwoSlotsAndFiltering(c *C) { c.Check(body, DeepEquals, []byte{}) EncodeResponseBody(c, w, map[string]interface{}{ "type": "sync", - "result": client.Interfaces{ + "result": client.Connections{ Slots: []client.Slot{ { Snap: "canonical-pi2", @@ -421,7 +421,7 @@ func (s *SnapSuite) TestInterfacesTwoSlotsAndFiltering(c *C) { c.Assert(s.Stderr(), Equals, "") } -func (s *SnapSuite) TestInterfacesOfSpecificSnap(c *C) { +func (s *SnapSuite) TestConnectionsOfSpecificSnap(c *C) { s.RedirectClientToTestServer(func(w http.ResponseWriter, r *http.Request) { c.Check(r.Method, Equals, "GET") c.Check(r.URL.Path, Equals, "/v2/interfaces") @@ -430,7 +430,7 @@ func (s *SnapSuite) TestInterfacesOfSpecificSnap(c *C) { c.Check(body, DeepEquals, []byte{}) EncodeResponseBody(c, w, map[string]interface{}{ "type": "sync", - "result": client.Interfaces{ + "result": client.Connections{ Slots: []client.Slot{ { Snap: "cheese", @@ -465,7 +465,7 @@ func (s *SnapSuite) TestInterfacesOfSpecificSnap(c *C) { c.Assert(s.Stderr(), Equals, "") } -func (s *SnapSuite) TestInterfacesOfSpecificSnapAndSlot(c *C) { +func (s *SnapSuite) TestConnectionsOfSpecificSnapAndSlot(c *C) { s.RedirectClientToTestServer(func(w http.ResponseWriter, r *http.Request) { c.Check(r.Method, Equals, "GET") c.Check(r.URL.Path, Equals, "/v2/interfaces") @@ -474,7 +474,7 @@ func (s *SnapSuite) TestInterfacesOfSpecificSnapAndSlot(c *C) { c.Check(body, DeepEquals, []byte{}) EncodeResponseBody(c, w, map[string]interface{}{ "type": "sync", - "result": client.Interfaces{ + "result": client.Connections{ Slots: []client.Slot{ { Snap: "cheese", @@ -508,7 +508,7 @@ func (s *SnapSuite) TestInterfacesOfSpecificSnapAndSlot(c *C) { c.Assert(s.Stderr(), Equals, "") } -func (s *SnapSuite) TestInterfacesNothingAtAll(c *C) { +func (s *SnapSuite) TestConnectionsNothingAtAll(c *C) { s.RedirectClientToTestServer(func(w http.ResponseWriter, r *http.Request) { c.Check(r.Method, Equals, "GET") c.Check(r.URL.Path, Equals, "/v2/interfaces") @@ -517,7 +517,7 @@ func (s *SnapSuite) TestInterfacesNothingAtAll(c *C) { c.Check(body, DeepEquals, []byte{}) EncodeResponseBody(c, w, map[string]interface{}{ "type": "sync", - "result": client.Interfaces{}, + "result": client.Connections{}, }) }) rest, err := Parser().ParseArgs([]string{"interfaces"}) @@ -529,7 +529,7 @@ func (s *SnapSuite) TestInterfacesNothingAtAll(c *C) { c.Assert(s.Stderr(), Equals, "") } -func (s *SnapSuite) TestInterfacesOfSpecificType(c *C) { +func (s *SnapSuite) TestConnectionsOfSpecificType(c *C) { s.RedirectClientToTestServer(func(w http.ResponseWriter, r *http.Request) { c.Check(r.Method, Equals, "GET") c.Check(r.URL.Path, Equals, "/v2/interfaces") @@ -538,7 +538,7 @@ func (s *SnapSuite) TestInterfacesOfSpecificType(c *C) { c.Check(body, DeepEquals, []byte{}) EncodeResponseBody(c, w, map[string]interface{}{ "type": "sync", - "result": client.Interfaces{ + "result": client.Connections{ Slots: []client.Slot{ { Snap: "cheese", @@ -574,14 +574,14 @@ func (s *SnapSuite) TestInterfacesOfSpecificType(c *C) { c.Assert(s.Stderr(), Equals, "") } -func (s *SnapSuite) TestInterfacesCompletion(c *C) { +func (s *SnapSuite) TestConnectionsCompletion(c *C) { s.RedirectClientToTestServer(func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case "/v2/interfaces": c.Assert(r.Method, Equals, "GET") EncodeResponseBody(c, w, map[string]interface{}{ "type": "sync", - "result": fortestingInterfaceList, + "result": fortestingConnectionList, }) default: c.Fatalf("unexpected path %q", r.URL.Path)