@@ -21,42 +21,42 @@ import (
2121 "github.com/hashicorp/consul/api"
2222)
2323
24- // ConsulClient is an interface for the Consul client.
25- type ConsulClient interface {
26- Agent () ConsulAgent
24+ // Client is an interface for the Consul client.
25+ type Client interface {
26+ Agent () Agent
2727}
2828
29- // ConsulAgent is an interface for the Consul agent.
30- type ConsulAgent interface {
29+ // Agent is an interface for the Consul agent.
30+ type Agent interface {
3131 Service (string , * api.QueryOptions ) (* api.AgentService , * api.QueryMeta , error )
3232 ServiceRegister (* api.AgentServiceRegistration ) error
3333}
3434
35- // ConsulAPIWrapper wraps the Consul API client to conform to the ConsulClient interface.
36- type ConsulAPIWrapper struct {
35+ // ApiWrapper wraps the Consul API client to conform to the Client interface.
36+ type ApiWrapper struct {
3737 client * api.Client
3838}
3939
40- // NewConsulAPIWrapper creates a new instance of ConsulAPIWrapper .
41- func NewConsulAPIWrapper (client * api.Client ) * ConsulAPIWrapper {
42- return & ConsulAPIWrapper {client : client }
40+ // NewConsulAPIWrapper creates a new instance of ApiWrapper .
41+ func NewConsulAPIWrapper (client * api.Client ) * ApiWrapper {
42+ return & ApiWrapper {client : client }
4343}
4444
45- // Agent returns an object that conforms to the ConsulAgent interface.
46- func (w * ConsulAPIWrapper ) Agent () ConsulAgent {
45+ // Agent returns an object that conforms to the Agent interface.
46+ func (w * ApiWrapper ) Agent () Agent {
4747 return w .client .Agent ()
4848}
4949
5050// ClientFactory is an interface for creating Consul clients
5151type ClientFactory interface {
52- NewClient (address , token string ) (ConsulClient , error )
52+ NewClient (address , token string ) (Client , error )
5353}
5454
5555// DefaultFactory creates real Consul clients
5656type DefaultFactory struct {}
5757
5858// NewClient creates a new Consul client with the given configuration
59- func (f * DefaultFactory ) NewClient (address , token string ) (ConsulClient , error ) {
59+ func (f * DefaultFactory ) NewClient (address , token string ) (Client , error ) {
6060 config := api .DefaultConfig ()
6161 config .Address = address
6262 config .Token = token
@@ -71,12 +71,12 @@ func (f *DefaultFactory) NewClient(address, token string) (ConsulClient, error)
7171
7272// MockFactory creates mock Consul clients for testing
7373type MockFactory struct {
74- MockClient ConsulClient
74+ MockClient Client
7575 MockError error
7676}
7777
7878// NewClient returns the mock client or error
79- func (f * MockFactory ) NewClient (address , token string ) (ConsulClient , error ) {
79+ func (f * MockFactory ) NewClient (address , token string ) (Client , error ) {
8080 if f .MockError != nil {
8181 return nil , f .MockError
8282 }
@@ -97,6 +97,6 @@ func ResetFactory() {
9797}
9898
9999// CreateClient is a convenience function that uses the global factory
100- func CreateClient (address , token string ) (ConsulClient , error ) {
100+ func CreateClient (address , token string ) (Client , error ) {
101101 return Factory .NewClient (address , token )
102- }
102+ }
0 commit comments