Documentation ¶
Index ¶
- type Client
- type MockClient
- func (c *MockClient) ApplyOption(opt MockClientOption)
- func (c *MockClient) CreateGraphDefs(graphDefs []*mackerel.GraphDefsParam) error
- func (c *MockClient) CreateHost(param *mackerel.CreateHostParam) (string, error)
- func (c *MockClient) FindHost(id string) (*mackerel.Host, error)
- func (c *MockClient) FindHosts(param *mackerel.FindHostsParam) ([]*mackerel.Host, error)
- func (c *MockClient) PostCheckReports(reports *mackerel.CheckReports) error
- func (c *MockClient) PostHostMetricValuesByHostID(hostID string, metricValues []*mackerel.MetricValue) error
- func (c *MockClient) PostedGraphDefs() []*mackerel.GraphDefsParam
- func (c *MockClient) PostedMetricValues() map[string][]*mackerel.MetricValue
- func (c *MockClient) RetireHost(id string) error
- func (c *MockClient) UpdateHost(hostID string, param *mackerel.UpdateHostParam) (string, error)
- func (c *MockClient) UpdateHostStatus(hostID string, status string) error
- type MockClientOption
- func MockCreateGraphDefs(callback func(graphDefs []*mackerel.GraphDefsParam) error) MockClientOption
- func MockCreateHost(callback func(param *mackerel.CreateHostParam) (string, error)) MockClientOption
- func MockFindHost(callback func(id string) (*mackerel.Host, error)) MockClientOption
- func MockFindHosts(callback func(param *mackerel.FindHostsParam) ([]*mackerel.Host, error)) MockClientOption
- func MockPostCheckReports(callback func(reports *mackerel.CheckReports) error) MockClientOption
- func MockPostHostMetricValuesByHostID(callback func(hostID string, metricValues []*mackerel.MetricValue) error) MockClientOption
- func MockRetireHost(callback func(id string) error) MockClientOption
- func MockUpdateHost(callback func(hostID string, param *mackerel.UpdateHostParam) (string, error)) MockClientOption
- func MockUpdateHostStatus(callback func(hostID string, status string) error) MockClientOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { FindHost(id string) (*mackerel.Host, error) FindHosts(param *mackerel.FindHostsParam) ([]*mackerel.Host, error) CreateHost(param *mackerel.CreateHostParam) (string, error) UpdateHost(hostID string, param *mackerel.UpdateHostParam) (string, error) UpdateHostStatus(hostID string, status string) error RetireHost(id string) error PostHostMetricValuesByHostID(hostID string, metricValues []*mackerel.MetricValue) error CreateGraphDefs([]*mackerel.GraphDefsParam) error PostCheckReports(reports *mackerel.CheckReports) error }
Client represents a client of Mackerel API
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
MockClient represents a mock client of Mackerel API
func NewMockClient ¶
func NewMockClient(opts ...MockClientOption) *MockClient
NewMockClient creates a new mock client of Mackerel API
func (*MockClient) ApplyOption ¶
func (c *MockClient) ApplyOption(opt MockClientOption)
ApplyOption applies a mock client option
func (*MockClient) CreateGraphDefs ¶
func (c *MockClient) CreateGraphDefs(graphDefs []*mackerel.GraphDefsParam) error
CreateGraphDefs ...
func (*MockClient) CreateHost ¶
func (c *MockClient) CreateHost(param *mackerel.CreateHostParam) (string, error)
CreateHost ...
func (*MockClient) FindHost ¶
func (c *MockClient) FindHost(id string) (*mackerel.Host, error)
FindHost ...
func (*MockClient) FindHosts ¶
func (c *MockClient) FindHosts(param *mackerel.FindHostsParam) ([]*mackerel.Host, error)
FindHosts ...
func (*MockClient) PostCheckReports ¶
func (c *MockClient) PostCheckReports(reports *mackerel.CheckReports) error
PostCheckReports ...
func (*MockClient) PostHostMetricValuesByHostID ¶
func (c *MockClient) PostHostMetricValuesByHostID(hostID string, metricValues []*mackerel.MetricValue) error
PostHostMetricValuesByHostID ...
func (*MockClient) PostedGraphDefs ¶
func (c *MockClient) PostedGraphDefs() []*mackerel.GraphDefsParam
PostedGraphDefs returns the posted graph definitions
func (*MockClient) PostedMetricValues ¶
func (c *MockClient) PostedMetricValues() map[string][]*mackerel.MetricValue
PostedMetricValues returns the posted metric values
func (*MockClient) UpdateHost ¶
func (c *MockClient) UpdateHost(hostID string, param *mackerel.UpdateHostParam) (string, error)
UpdateHost ...
func (*MockClient) UpdateHostStatus ¶
func (c *MockClient) UpdateHostStatus(hostID string, status string) error
UpdateHostStatus ...
type MockClientOption ¶
type MockClientOption func(*MockClient)
MockClientOption represents an option of mock client of Mackerel API
func MockCreateGraphDefs ¶
func MockCreateGraphDefs(callback func(graphDefs []*mackerel.GraphDefsParam) error) MockClientOption
MockCreateGraphDefs returns an option to set the callback of CreateGraphDefs
func MockCreateHost ¶
func MockCreateHost(callback func(param *mackerel.CreateHostParam) (string, error)) MockClientOption
MockCreateHost returns an option to set the callback of CreateHost
func MockFindHost ¶
func MockFindHost(callback func(id string) (*mackerel.Host, error)) MockClientOption
MockFindHost returns an option to set the callback of FindHost
func MockFindHosts ¶
func MockFindHosts(callback func(param *mackerel.FindHostsParam) ([]*mackerel.Host, error)) MockClientOption
MockFindHosts returns an option to set the callback of FindHosts
func MockPostCheckReports ¶
func MockPostCheckReports(callback func(reports *mackerel.CheckReports) error) MockClientOption
MockPostCheckReports returns an option to set the callback of PostCheckReports
func MockPostHostMetricValuesByHostID ¶
func MockPostHostMetricValuesByHostID(callback func(hostID string, metricValues []*mackerel.MetricValue) error) MockClientOption
MockPostHostMetricValuesByHostID returns an option to set the callback of PostHostMetricValuesByHostID
func MockRetireHost ¶
func MockRetireHost(callback func(id string) error) MockClientOption
MockRetireHost returns an option to set the callback of RetireHost
func MockUpdateHost ¶
func MockUpdateHost(callback func(hostID string, param *mackerel.UpdateHostParam) (string, error)) MockClientOption
MockUpdateHost returns an option to set the callback of UpdateHost
func MockUpdateHostStatus ¶
func MockUpdateHostStatus(callback func(hostID string, status string) error) MockClientOption
MockUpdateHostStatus returns an option to set the callback of UpdateHostStatus