client

package
v2.0.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2019 License: MIT Imports: 11 Imported by: 0

README

go-graylog client

GoDoc Build Status codecov Go Report Card GitHub last commit GitHub tag License

Graylog API client for Golang.

See https://github.com/suzuki-shunsuke/go-graylog

Documentation

Overview

Package client provides Graylog API client.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a Graylog API client.

Example
package main

import (
	"fmt"
	"log"

	"github.com/suzuki-shunsuke/go-graylog/client"
	"github.com/suzuki-shunsuke/go-graylog/mockserver"
)

func main() {
	// Create a mock server
	server, err := mockserver.NewServer("", nil)
	if err != nil {
		log.Fatal(err)
	}
	// Start a server
	server.Start()
	defer server.Close()

	// Create a client
	cl, err := client.NewClient(server.Endpoint(), "admin", "admin")
	if err != nil {
		log.Fatal(err)
	}

	// get a role "Admin"
	// ei.Response.Body is closed
	role, ei, err := cl.GetRole("Admin")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(ei.Response.StatusCode)
	fmt.Println(role.Name)
}
Output:

200
Admin

func NewClient

func NewClient(ep, name, password string) (*Client, error)

NewClient returns a new Graylog API Client. ep is API endpoint url (ex. http://localhost:9000/api). name and password are authentication name and password. If you use an access token instead of password, name is access token and password is literal password "token". If you use a session token instead of password, name is session token and password is literal password "session".

func (*Client) AddUserToRole

func (client *Client) AddUserToRole(userName, roleName string) (
	*ErrorInfo, error,
)

AddUserToRole adds a user to a role.

func (*Client) AddUserToRoleContext

func (client *Client) AddUserToRoleContext(
	ctx context.Context, userName, roleName string,
) (*ErrorInfo, error)

AddUserToRoleContext adds a user to a role with a context.

func (*Client) CreateCollectorConfiguration added in v0.7.0

func (client *Client) CreateCollectorConfiguration(cfg *graylog.CollectorConfiguration) (*ErrorInfo, error)

CreateCollectorConfiguration creates a collector configuration.

func (*Client) CreateCollectorConfigurationContext added in v0.7.0

func (client *Client) CreateCollectorConfigurationContext(
	ctx context.Context, cfg *graylog.CollectorConfiguration,
) (*ErrorInfo, error)

CreateCollectorConfigurationContext creates a collector configuration with a context.

func (*Client) CreateCollectorConfigurationInput added in v0.7.0

func (client *Client) CreateCollectorConfigurationInput(
	id string, input *graylog.CollectorConfigurationInput,
) (*ErrorInfo, error)

CreateCollectorConfigurationInput creates a collector configuration input.

func (*Client) CreateCollectorConfigurationInputContext added in v0.7.0

func (client *Client) CreateCollectorConfigurationInputContext(
	ctx context.Context, id string, input *graylog.CollectorConfigurationInput,
) (*ErrorInfo, error)

CreateCollectorConfigurationInputContext creates a collector configuration input with a context.

func (*Client) CreateCollectorConfigurationOutput added in v0.7.0

func (client *Client) CreateCollectorConfigurationOutput(
	id string, output *graylog.CollectorConfigurationOutput,
) (*ErrorInfo, error)

CreateCollectorConfigurationOutput creates a collector configuration output.

func (*Client) CreateCollectorConfigurationOutputContext added in v0.7.0

func (client *Client) CreateCollectorConfigurationOutputContext(
	ctx context.Context, id string, output *graylog.CollectorConfigurationOutput,
) (*ErrorInfo, error)

CreateCollectorConfigurationOutputContext creates a collector configuration output with a context.

func (*Client) CreateCollectorConfigurationSnippet added in v0.7.0

func (client *Client) CreateCollectorConfigurationSnippet(
	id string, snippet *graylog.CollectorConfigurationSnippet,
) (*ErrorInfo, error)

CreateCollectorConfigurationSnippet creates a collector configuration snippet.

func (*Client) CreateCollectorConfigurationSnippetContext added in v0.7.0

func (client *Client) CreateCollectorConfigurationSnippetContext(
	ctx context.Context, id string, snippet *graylog.CollectorConfigurationSnippet,
) (*ErrorInfo, error)

CreateCollectorConfigurationSnippetContext creates a collector configuration snippet with a context.

func (*Client) CreateDashboard added in v0.4.0

func (client *Client) CreateDashboard(dashboard *graylog.Dashboard) (*ErrorInfo, error)

CreateDashboard creates a new dashboard account.

func (*Client) CreateDashboardContext added in v0.4.0

func (client *Client) CreateDashboardContext(
	ctx context.Context, dashboard *graylog.Dashboard,
) (*ErrorInfo, error)

CreateDashboardContext creates a new dashboard account with a context.

func (*Client) CreateDashboardWidget added in v0.8.0

func (client *Client) CreateDashboardWidget(dashboardID string, widget graylog.Widget) (graylog.Widget, *ErrorInfo, error)

CreateDashboardWidget creates a new dashboard widget.

func (*Client) CreateDashboardWidgetContext added in v0.8.0

func (client *Client) CreateDashboardWidgetContext(
	ctx context.Context, dashboardID string, widget graylog.Widget,
) (graylog.Widget, *ErrorInfo, error)

CreateDashboardWidgetContext creates a new dashboard widget with a context.

func (*Client) CreateIndexSet

func (client *Client) CreateIndexSet(indexSet *graylog.IndexSet) (*ErrorInfo, error)

CreateIndexSet creates a Index Set.

func (*Client) CreateIndexSetContext

func (client *Client) CreateIndexSetContext(
	ctx context.Context, is *graylog.IndexSet,
) (*ErrorInfo, error)

CreateIndexSetContext creates a Index Set with a context.

func (*Client) CreateInput

func (client *Client) CreateInput(input *graylog.Input) (
	ei *ErrorInfo, err error,
)

CreateInput creates an input.

func (*Client) CreateInputContext

func (client *Client) CreateInputContext(
	ctx context.Context, input *graylog.Input,
) (ei *ErrorInfo, err error)

CreateInputContext creates an input with a context.

func (*Client) CreatePipelineRule added in v1.4.0

func (client *Client) CreatePipelineRule(
	rule *graylog.PipelineRule,
) (*ErrorInfo, error)

CreatePipelineRule creates a pipeline rule.

func (*Client) CreatePipelineRuleContext added in v1.4.0

func (client *Client) CreatePipelineRuleContext(
	ctx context.Context, rule *graylog.PipelineRule,
) (*ErrorInfo, error)

CreatePipelineRuleContext creates a pipeline rule with a context.

func (*Client) CreateRole

func (client *Client) CreateRole(role *graylog.Role) (*ErrorInfo, error)

CreateRole creates a new role.

func (*Client) CreateRoleContext

func (client *Client) CreateRoleContext(
	ctx context.Context, role *graylog.Role,
) (*ErrorInfo, error)

CreateRoleContext creates a new role with a context.

func (*Client) CreateStream

func (client *Client) CreateStream(stream *graylog.Stream) (*ErrorInfo, error)

CreateStream creates a stream.

func (*Client) CreateStreamAlarmCallback added in v1.1.0

func (client *Client) CreateStreamAlarmCallback(ac *graylog.AlarmCallback) (*ErrorInfo, error)

CreateStreamAlarmCallback creates an alarm callback.

func (*Client) CreateStreamAlarmCallbackContext added in v1.1.0

func (client *Client) CreateStreamAlarmCallbackContext(
	ctx context.Context, ac *graylog.AlarmCallback,
) (*ErrorInfo, error)

CreateStreamAlarmCallbackContext creates an alarm callback with a context.

func (*Client) CreateStreamAlertCondition added in v1.0.0

func (client *Client) CreateStreamAlertCondition(streamID string, cond *graylog.AlertCondition) (*ErrorInfo, error)

CreateStreamAlertCondition creates an alert condition.

func (*Client) CreateStreamAlertConditionContext added in v1.0.0

func (client *Client) CreateStreamAlertConditionContext(
	ctx context.Context, streamID string, cond *graylog.AlertCondition,
) (*ErrorInfo, error)

CreateStreamAlertConditionContext creates an alert condition with a context.

func (*Client) CreateStreamContext

func (client *Client) CreateStreamContext(
	ctx context.Context, stream *graylog.Stream,
) (*ErrorInfo, error)

CreateStreamContext creates a stream with a context.

func (*Client) CreateStreamRule

func (client *Client) CreateStreamRule(rule *graylog.StreamRule) (*ErrorInfo, error)

CreateStreamRule creates a stream

func (*Client) CreateStreamRuleContext

func (client *Client) CreateStreamRuleContext(
	ctx context.Context, rule *graylog.StreamRule,
) (*ErrorInfo, error)

CreateStreamRuleContext creates a stream with a context

func (*Client) CreateUser

func (client *Client) CreateUser(user *graylog.User) (*ErrorInfo, error)

CreateUser creates a new user account.

func (*Client) CreateUserContext

func (client *Client) CreateUserContext(
	ctx context.Context, user *graylog.User,
) (*ErrorInfo, error)

CreateUserContext creates a new user account with a context.

func (*Client) DeleteCollectorConfiguration added in v0.7.0

func (client *Client) DeleteCollectorConfiguration(id string) (*ErrorInfo, error)

DeleteCollectorConfiguration deletes a collector configuration.

func (*Client) DeleteCollectorConfigurationContext added in v0.7.0

func (client *Client) DeleteCollectorConfigurationContext(
	ctx context.Context, id string,
) (*ErrorInfo, error)

DeleteCollectorConfigurationContext deletes a collector configuration with a context.

func (*Client) DeleteCollectorConfigurationInput added in v0.7.0

func (client *Client) DeleteCollectorConfigurationInput(id, inputID string) (*ErrorInfo, error)

DeleteCollectorConfigurationInput deletes a collector configuration input.

func (*Client) DeleteCollectorConfigurationInputContext added in v0.7.0

func (client *Client) DeleteCollectorConfigurationInputContext(
	ctx context.Context, id, inputID string,
) (*ErrorInfo, error)

DeleteCollectorConfigurationInputContext deletes a collector configuration input with a context.

func (*Client) DeleteCollectorConfigurationOutput added in v0.7.0

func (client *Client) DeleteCollectorConfigurationOutput(id, outputID string) (*ErrorInfo, error)

DeleteCollectorConfigurationOutput deletes a collector configuration output.

func (*Client) DeleteCollectorConfigurationOutputContext added in v0.7.0

func (client *Client) DeleteCollectorConfigurationOutputContext(
	ctx context.Context, id, outputID string,
) (*ErrorInfo, error)

DeleteCollectorConfigurationOutputContext deletes a collector configuration output with a context.

func (*Client) DeleteCollectorConfigurationSnippet added in v0.7.0

func (client *Client) DeleteCollectorConfigurationSnippet(id, snippetID string) (*ErrorInfo, error)

DeleteCollectorConfigurationSnippet deletes a collector configuration snippet.

func (*Client) DeleteCollectorConfigurationSnippetContext added in v0.7.0

func (client *Client) DeleteCollectorConfigurationSnippetContext(
	ctx context.Context, id, snippetID string,
) (*ErrorInfo, error)

DeleteCollectorConfigurationSnippetContext deletes a collector configuration snippet with a context.

func (*Client) DeleteDashboard added in v0.4.0

func (client *Client) DeleteDashboard(id string) (*ErrorInfo, error)

DeleteDashboard deletes a given dashboard.

func (*Client) DeleteDashboardContext added in v0.4.0

func (client *Client) DeleteDashboardContext(
	ctx context.Context, id string,
) (*ErrorInfo, error)

DeleteDashboardContext deletes a given dashboard with a context.

func (*Client) DeleteDashboardWidget added in v0.8.0

func (client *Client) DeleteDashboardWidget(dashboardID, widgetID string) (*ErrorInfo, error)

DeleteDashboardWidget deletes a given dashboard widget.

func (*Client) DeleteDashboardWidgetContext added in v0.8.0

func (client *Client) DeleteDashboardWidgetContext(
	ctx context.Context, dashboardID, widgetID string,
) (*ErrorInfo, error)

DeleteDashboardWidgetContext deletes a given dashboard widget with a context.

func (*Client) DeleteIndexSet

func (client *Client) DeleteIndexSet(id string) (*ErrorInfo, error)

DeleteIndexSet deletes a given Index Set.

func (*Client) DeleteIndexSetContext

func (client *Client) DeleteIndexSetContext(
	ctx context.Context, id string,
) (*ErrorInfo, error)

DeleteIndexSetContext deletes a given Index Set with a context.

func (*Client) DeleteInput

func (client *Client) DeleteInput(id string) (*ErrorInfo, error)

DeleteInput deletes an given input.

func (*Client) DeleteInputContext

func (client *Client) DeleteInputContext(
	ctx context.Context, id string,
) (*ErrorInfo, error)

DeleteInputContext deletes an given input with a context.

func (*Client) DeleteLDAPSetting added in v0.6.0

func (client *Client) DeleteLDAPSetting() (*ErrorInfo, error)

DeleteLDAPSetting deletes the LDAP setting.

func (*Client) DeleteLDAPSettingContext added in v0.6.0

func (client *Client) DeleteLDAPSettingContext(
	ctx context.Context,
) (*ErrorInfo, error)

DeleteLDAPSettingContext deletes the LDAP setting with a context.

func (*Client) DeletePipelineRule added in v1.4.0

func (client *Client) DeletePipelineRule(id string) (*ErrorInfo, error)

DeletePipelineRule deletes a pipeline rule.

func (*Client) DeletePipelineRuleContext added in v1.4.0

func (client *Client) DeletePipelineRuleContext(
	ctx context.Context, id string,
) (*ErrorInfo, error)

DeletePipelineRuleContext deletes a pipeline rule with a context.

func (*Client) DeleteRole

func (client *Client) DeleteRole(name string) (*ErrorInfo, error)

DeleteRole deletes a given role.

func (*Client) DeleteRoleContext

func (client *Client) DeleteRoleContext(
	ctx context.Context, name string,
) (*ErrorInfo, error)

DeleteRoleContext deletes a given role with a context.

func (*Client) DeleteStream

func (client *Client) DeleteStream(id string) (*ErrorInfo, error)

DeleteStream deletes a stream.

func (*Client) DeleteStreamAlarmCallback added in v1.1.0

func (client *Client) DeleteStreamAlarmCallback(streamID, id string) (*ErrorInfo, error)

DeleteStreamAlarmCallback deletes an alarm callback.

func (*Client) DeleteStreamAlarmCallbackContext added in v1.1.0

func (client *Client) DeleteStreamAlarmCallbackContext(
	ctx context.Context, streamID, id string,
) (*ErrorInfo, error)

DeleteStreamAlarmCallbackContext deletes an alarm callback with a context.

func (*Client) DeleteStreamAlertCondition added in v1.0.0

func (client *Client) DeleteStreamAlertCondition(streamID, id string) (*ErrorInfo, error)

DeleteStreamAlertCondition deletes an alert condition.

func (*Client) DeleteStreamAlertConditionContext added in v1.0.0

func (client *Client) DeleteStreamAlertConditionContext(
	ctx context.Context, streamID, id string,
) (*ErrorInfo, error)

DeleteStreamAlertConditionContext deletes an alert condition with a context.

func (*Client) DeleteStreamContext

func (client *Client) DeleteStreamContext(
	ctx context.Context, id string,
) (*ErrorInfo, error)

DeleteStreamContext deletes a stream with a context.

func (*Client) DeleteStreamRule

func (client *Client) DeleteStreamRule(streamID, ruleID string) (*ErrorInfo, error)

DeleteStreamRule deletes a stream rule

func (*Client) DeleteStreamRuleContext

func (client *Client) DeleteStreamRuleContext(
	ctx context.Context, streamID, ruleID string,
) (*ErrorInfo, error)

DeleteStreamRuleContext deletes a stream rule with a context

func (*Client) DeleteUser

func (client *Client) DeleteUser(name string) (*ErrorInfo, error)

DeleteUser deletes a given user.

func (*Client) DeleteUserContext

func (client *Client) DeleteUserContext(
	ctx context.Context, name string,
) (*ErrorInfo, error)

DeleteUserContext deletes a given user with a context.

func (*Client) Endpoints

func (client *Client) Endpoints() *endpoint.Endpoints

Endpoints returns endpoints.

func (*Client) GetAlarmCallbacks added in v0.5.0

func (client *Client) GetAlarmCallbacks() (
	[]graylog.AlarmCallback, int, *ErrorInfo, error,
)

GetAlarmCallbacks returns all alarm callbacks.

func (*Client) GetAlarmCallbacksContext added in v0.5.0

func (client *Client) GetAlarmCallbacksContext(ctx context.Context) (
	[]graylog.AlarmCallback, int, *ErrorInfo, error,
)

GetAlarmCallbacksContext returns all alarm callbacks with a context.

func (*Client) GetAlert added in v0.3.0

func (client *Client) GetAlert(id string) (*graylog.Alert, *ErrorInfo, error)

GetAlert returns an alert.

func (*Client) GetAlertConditions added in v0.2.0

func (client *Client) GetAlertConditions() ([]graylog.AlertCondition, int, *ErrorInfo, error)

GetAlertConditions returns all alert conditions.

func (*Client) GetAlertConditionsContext added in v0.2.0

func (client *Client) GetAlertConditionsContext(ctx context.Context) (
	[]graylog.AlertCondition, int, *ErrorInfo, error,
)

GetAlertConditionsContext returns all alert conditions with a context.

func (*Client) GetAlertContext added in v0.3.0

func (client *Client) GetAlertContext(ctx context.Context, id string) (
	*graylog.Alert, *ErrorInfo, error,
)

GetAlertContext returns an alert with a context.

func (*Client) GetAlerts added in v0.3.0

func (client *Client) GetAlerts(
	skip, limit int,
) ([]graylog.Alert, int, *ErrorInfo, error)

GetAlerts returns all alerts.

func (*Client) GetAlertsContext added in v0.3.0

func (client *Client) GetAlertsContext(ctx context.Context, skip, limit int) (
	[]graylog.Alert, int, *ErrorInfo, error,
)

GetAlertsContext returns all alerts with a context.

func (*Client) GetCollectorConfiguration added in v0.7.0

func (client *Client) GetCollectorConfiguration(id string) (*graylog.CollectorConfiguration, *ErrorInfo, error)

GetCollectorConfiguration returns a collector configuration.

func (*Client) GetCollectorConfigurationContext added in v0.7.0

func (client *Client) GetCollectorConfigurationContext(
	ctx context.Context, id string,
) (*graylog.CollectorConfiguration, *ErrorInfo, error)

GetCollectorConfigurationContext returns a given user with a context.

func (*Client) GetCollectorConfigurations added in v0.7.0

func (client *Client) GetCollectorConfigurations() ([]graylog.CollectorConfiguration, int, *ErrorInfo, error)

GetCollectorConfigurations returns all collector configurations.

func (*Client) GetCollectorConfigurationsContext added in v0.7.0

func (client *Client) GetCollectorConfigurationsContext(ctx context.Context) ([]graylog.CollectorConfiguration, int, *ErrorInfo, error)

GetCollectorConfigurationsContext returns all collector configurations with a context.

func (*Client) GetDashboard added in v0.4.0

func (client *Client) GetDashboard(id string) (*graylog.Dashboard, *ErrorInfo, error)

GetDashboard returns a given dashboard.

func (*Client) GetDashboardContext added in v0.4.0

func (client *Client) GetDashboardContext(
	ctx context.Context, id string,
) (*graylog.Dashboard, *ErrorInfo, error)

GetDashboardContext returns a given dashboard with a context.

func (*Client) GetDashboardWidget added in v0.8.0

func (client *Client) GetDashboardWidget(dashboardID, widgetID string) (graylog.Widget, *ErrorInfo, error)

GetDashboardWidget gets a dashboard widget.

func (*Client) GetDashboardWidgetContext added in v0.8.0

func (client *Client) GetDashboardWidgetContext(
	ctx context.Context, dashboardID, widgetID string,
) (graylog.Widget, *ErrorInfo, error)

GetDashboardWidgetContext gets a dashboard widget with a context.

func (*Client) GetDashboards added in v0.4.0

func (client *Client) GetDashboards() ([]graylog.Dashboard, int, *ErrorInfo, error)

GetDashboards returns all dashboards.

func (*Client) GetDashboardsContext added in v0.4.0

func (client *Client) GetDashboardsContext(ctx context.Context) ([]graylog.Dashboard, int, *ErrorInfo, error)

GetDashboardsContext returns all dashboards with a context.

func (*Client) GetEnabledStreams

func (client *Client) GetEnabledStreams() (
	streams []graylog.Stream, total int, ei *ErrorInfo, err error,
)

GetEnabledStreams returns all enabled streams.

func (*Client) GetEnabledStreamsContext

func (client *Client) GetEnabledStreamsContext(
	ctx context.Context,
) (streams []graylog.Stream, total int, ei *ErrorInfo, err error)

GetEnabledStreamsContext returns all enabled streams with a context.

func (*Client) GetIndexSet

func (client *Client) GetIndexSet(id string) (*graylog.IndexSet, *ErrorInfo, error)

GetIndexSet returns a given index set.

func (*Client) GetIndexSetContext

func (client *Client) GetIndexSetContext(
	ctx context.Context, id string,
) (*graylog.IndexSet, *ErrorInfo, error)

GetIndexSetContext returns a given index set with a context.

func (*Client) GetIndexSetStats

func (client *Client) GetIndexSetStats(id string) (
	*graylog.IndexSetStats, *ErrorInfo, error,
)

GetIndexSetStats returns a given Index Set statistics.

func (*Client) GetIndexSetStatsContext

func (client *Client) GetIndexSetStatsContext(
	ctx context.Context, id string,
) (*graylog.IndexSetStats, *ErrorInfo, error)

GetIndexSetStatsContext returns a given Index Set statistics with a context.

func (*Client) GetIndexSets

func (client *Client) GetIndexSets(
	skip, limit int, stats bool,
) ([]graylog.IndexSet, map[string]graylog.IndexSetStats, int, *ErrorInfo, error)

GetIndexSets returns a list of all index sets.

func (*Client) GetIndexSetsContext

func (client *Client) GetIndexSetsContext(
	ctx context.Context, skip, limit int, stats bool,
) ([]graylog.IndexSet, map[string]graylog.IndexSetStats, int, *ErrorInfo, error)

GetIndexSetsContext returns a list of all index sets with a context.

func (*Client) GetInput

func (client *Client) GetInput(id string) (*graylog.Input, *ErrorInfo, error)

GetInput returns a given input.

func (*Client) GetInputContext

func (client *Client) GetInputContext(
	ctx context.Context, id string,
) (*graylog.Input, *ErrorInfo, error)

GetInputContext returns a given input with a context.

func (*Client) GetInputs

func (client *Client) GetInputs() ([]graylog.Input, int, *ErrorInfo, error)

GetInputs returns all inputs.

func (*Client) GetInputsContext

func (client *Client) GetInputsContext(ctx context.Context) (
	[]graylog.Input, int, *ErrorInfo, error,
)

GetInputsContext returns all inputs with a context.

func (*Client) GetLDAPGroupRoleMapping added in v0.10.0

func (client *Client) GetLDAPGroupRoleMapping() (map[string]string, *ErrorInfo, error)

GetLDAPGroupRoleMapping returns the LDAP group and role mapping.

func (*Client) GetLDAPGroupRoleMappingContext added in v0.10.0

func (client *Client) GetLDAPGroupRoleMappingContext(ctx context.Context) (map[string]string, *ErrorInfo, error)

GetLDAPGroupRoleMappingContext returns the LDAP group and role mapping with a context.

func (*Client) GetLDAPGroups added in v0.10.0

func (client *Client) GetLDAPGroups() ([]string, *ErrorInfo, error)

GetLDAPGroups returns the available LDAP groups.

func (*Client) GetLDAPGroupsContext added in v0.10.0

func (client *Client) GetLDAPGroupsContext(ctx context.Context) ([]string, *ErrorInfo, error)

GetLDAPGroupsContext returns the available LDAP groups with a context.

func (*Client) GetLDAPSetting added in v0.6.0

func (client *Client) GetLDAPSetting() (*graylog.LDAPSetting, *ErrorInfo, error)

GetLDAPSetting returns the LDAP setting.

func (*Client) GetLDAPSettingContext added in v0.6.0

func (client *Client) GetLDAPSettingContext(ctx context.Context) (
	*graylog.LDAPSetting, *ErrorInfo, error,
)

GetLDAPSettingContext returns the LDAP setting with a context.

func (*Client) GetPipelineRule added in v1.4.0

func (client *Client) GetPipelineRule(id string) (*graylog.PipelineRule, *ErrorInfo, error)

GetPipelineRule returns a pipeline rule.

func (*Client) GetPipelineRuleContext added in v1.4.0

func (client *Client) GetPipelineRuleContext(ctx context.Context, id string) (
	*graylog.PipelineRule, *ErrorInfo, error,
)

GetPipelineRuleContext returns a pipeline rule with a context.

func (*Client) GetPipelineRules added in v1.4.0

func (client *Client) GetPipelineRules() ([]graylog.PipelineRule, *ErrorInfo, error)

GetPipelineRules returns all pipeline rules.

func (*Client) GetPipelineRulesContext added in v1.4.0

func (client *Client) GetPipelineRulesContext(ctx context.Context) (
	[]graylog.PipelineRule, *ErrorInfo, error,
)

GetPipelineRulesContext returns all pipeline rules with a context.

func (*Client) GetRole

func (client *Client) GetRole(name string) (*graylog.Role, *ErrorInfo, error)

GetRole returns a given role.

func (*Client) GetRoleContext

func (client *Client) GetRoleContext(
	ctx context.Context, name string,
) (*graylog.Role, *ErrorInfo, error)

GetRoleContext returns a given role with a context.

func (*Client) GetRoleMembers

func (client *Client) GetRoleMembers(name string) ([]graylog.User, *ErrorInfo, error)

GetRoleMembers returns a given role's members.

func (*Client) GetRoleMembersContext

func (client *Client) GetRoleMembersContext(
	ctx context.Context, name string,
) ([]graylog.User, *ErrorInfo, error)

GetRoleMembersContext returns a given role's members with a context.

func (*Client) GetRoles

func (client *Client) GetRoles() ([]graylog.Role, int, *ErrorInfo, error)

GetRoles returns all roles.

func (*Client) GetRolesContext

func (client *Client) GetRolesContext(ctx context.Context) (
	[]graylog.Role, int, *ErrorInfo, error,
)

GetRolesContext returns all roles with a context.

func (*Client) GetStream

func (client *Client) GetStream(id string) (*graylog.Stream, *ErrorInfo, error)

GetStream returns a given stream.

func (*Client) GetStreamAlarmCallback added in v1.1.0

func (client *Client) GetStreamAlarmCallback(
	streamID, id string,
) (graylog.AlarmCallback, *ErrorInfo, error)

GetStreamAlarmCallback gets an alarm callback.

func (*Client) GetStreamAlarmCallbackContext added in v1.1.0

func (client *Client) GetStreamAlarmCallbackContext(
	ctx context.Context, streamID, id string,
) (graylog.AlarmCallback, *ErrorInfo, error)

GetStreamAlarmCallbackContext gets an alarm callback with a context.

func (*Client) GetStreamAlarmCallbacks added in v1.1.0

func (client *Client) GetStreamAlarmCallbacks(streamID string) (
	acs []graylog.AlarmCallback, total int, ei *ErrorInfo, err error,
)

GetStreamAlarmCallbacks gets all alarm callbacks of this stream.

func (*Client) GetStreamAlarmCallbacksContext added in v1.1.0

func (client *Client) GetStreamAlarmCallbacksContext(
	ctx context.Context, streamID string,
) (acs []graylog.AlarmCallback, total int, ei *ErrorInfo, err error)

GetStreamAlarmCallbacksContext gets all alarm callbacks of this stream with a context.

func (*Client) GetStreamAlertCondition added in v1.0.0

func (client *Client) GetStreamAlertCondition(streamID, id string) (graylog.AlertCondition, *ErrorInfo, error)

GetStreamAlertCondition gets an alert condition.

func (*Client) GetStreamAlertConditionContext added in v1.0.0

func (client *Client) GetStreamAlertConditionContext(
	ctx context.Context, streamID, id string,
) (graylog.AlertCondition, *ErrorInfo, error)

GetStreamAlertConditionContext gets an alert condition with a context.

func (*Client) GetStreamAlertConditions added in v1.0.0

func (client *Client) GetStreamAlertConditions(streamID string) (
	conds []graylog.AlertCondition, total int, ei *ErrorInfo, err error,
)

GetStreamAlertConditions gets all alert conditions of this stream.

func (*Client) GetStreamAlertConditionsContext added in v1.0.0

func (client *Client) GetStreamAlertConditionsContext(
	ctx context.Context, streamID string,
) (conds []graylog.AlertCondition, total int, ei *ErrorInfo, err error)

GetStreamAlertConditionsContext gets all alert conditions of this stream with a context.

func (*Client) GetStreamContext

func (client *Client) GetStreamContext(
	ctx context.Context, id string,
) (*graylog.Stream, *ErrorInfo, error)

GetStreamContext returns a given stream with a context.

func (*Client) GetStreamRule

func (client *Client) GetStreamRule(streamID, ruleID string) (*graylog.StreamRule, *ErrorInfo, error)

GetStreamRule returns a stream rule

func (*Client) GetStreamRuleContext

func (client *Client) GetStreamRuleContext(
	ctx context.Context, streamID, ruleID string,
) (*graylog.StreamRule, *ErrorInfo, error)

GetStreamRuleContext returns a stream rule with a context

func (*Client) GetStreamRules

func (client *Client) GetStreamRules(streamID string) (
	streamRules []graylog.StreamRule, total int, ei *ErrorInfo, err error,
)

GetStreamRules returns a list of all stream rules

func (*Client) GetStreamRulesContext

func (client *Client) GetStreamRulesContext(
	ctx context.Context, streamID string,
) (streamRules []graylog.StreamRule, total int, ei *ErrorInfo, err error)

GetStreamRulesContext returns a list of all stream rules with a context.

func (*Client) GetStreams

func (client *Client) GetStreams() (
	streams []graylog.Stream, total int, ei *ErrorInfo, err error,
)

GetStreams returns all streams.

func (*Client) GetStreamsContext

func (client *Client) GetStreamsContext(
	ctx context.Context,
) (streams []graylog.Stream, total int, ei *ErrorInfo, err error)

GetStreamsContext returns all streams with a context.

func (*Client) GetTotalIndexSetsStats

func (client *Client) GetTotalIndexSetsStats() (
	*graylog.IndexSetStats, *ErrorInfo, error,
)

GetTotalIndexSetsStats returns stats of all Index Sets.

func (*Client) GetTotalIndexSetsStatsContext

func (client *Client) GetTotalIndexSetsStatsContext(
	ctx context.Context,
) (*graylog.IndexSetStats, *ErrorInfo, error)

GetTotalIndexSetsStatsContext returns stats of all Index Sets with a context.

func (*Client) GetUser

func (client *Client) GetUser(name string) (*graylog.User, *ErrorInfo, error)

GetUser returns a given user.

func (*Client) GetUserContext

func (client *Client) GetUserContext(
	ctx context.Context, name string,
) (*graylog.User, *ErrorInfo, error)

GetUserContext returns a given user with a context.

func (*Client) GetUsers

func (client *Client) GetUsers() ([]graylog.User, *ErrorInfo, error)

GetUsers returns all users.

func (*Client) GetUsersContext

func (client *Client) GetUsersContext(ctx context.Context) ([]graylog.User, *ErrorInfo, error)

GetUsersContext returns all users with a context.

func (*Client) Name

func (client *Client) Name() string

Name returns authentication name.

func (*Client) Password

func (client *Client) Password() string

Password returns authentication password.

func (*Client) PauseStream

func (client *Client) PauseStream(id string) (*ErrorInfo, error)

PauseStream pauses a stream.

func (*Client) PauseStreamContext

func (client *Client) PauseStreamContext(
	ctx context.Context, id string,
) (*ErrorInfo, error)

PauseStreamContext pauses a stream with a context.

func (*Client) RemoveUserFromRole

func (client *Client) RemoveUserFromRole(
	userName, roleName string,
) (*ErrorInfo, error)

RemoveUserFromRole removes a user from a role.

func (*Client) RemoveUserFromRoleContext

func (client *Client) RemoveUserFromRoleContext(
	ctx context.Context, userName, roleName string,
) (*ErrorInfo, error)

RemoveUserFromRoleContext removes a user from a role with a context.

func (*Client) RenameCollectorConfiguration added in v0.7.0

func (client *Client) RenameCollectorConfiguration(id, name string) (*graylog.CollectorConfiguration, *ErrorInfo, error)

RenameCollectorConfiguration renames a collector configuration.

func (*Client) RenameCollectorConfigurationContext added in v0.7.0

func (client *Client) RenameCollectorConfigurationContext(
	ctx context.Context, id, name string,
) (*graylog.CollectorConfiguration, *ErrorInfo, error)

RenameCollectorConfigurationContext renames a collector configuration with a context.

func (*Client) ResumeStream

func (client *Client) ResumeStream(id string) (*ErrorInfo, error)

ResumeStream resumes a stream.

func (*Client) ResumeStreamContext

func (client *Client) ResumeStreamContext(
	ctx context.Context, id string,
) (*ErrorInfo, error)

ResumeStreamContext resumes a stream with a context.

func (*Client) SetDefaultIndexSet

func (client *Client) SetDefaultIndexSet(id string) (
	*graylog.IndexSet, *ErrorInfo, error,
)

SetDefaultIndexSet sets default Index Set.

func (*Client) SetDefaultIndexSetContext

func (client *Client) SetDefaultIndexSetContext(
	ctx context.Context, id string,
) (*graylog.IndexSet, *ErrorInfo, error)

SetDefaultIndexSetContext sets default Index Set with a context.

func (*Client) SetXRequestedBy added in v0.11.0

func (client *Client) SetXRequestedBy(x string)

SetXRequestedBy sets a custom header "X-Requested-By". The default value is "go-graylog".

func (*Client) UpdateCollectorConfigurationInput added in v0.7.0

func (client *Client) UpdateCollectorConfigurationInput(
	id, inputID string, input *graylog.CollectorConfigurationInput,
) (*ErrorInfo, error)

UpdateCollectorConfigurationInput updates a collector configuration input.

func (*Client) UpdateCollectorConfigurationInputContext added in v0.7.0

func (client *Client) UpdateCollectorConfigurationInputContext(
	ctx context.Context, id, inputID string,
	input *graylog.CollectorConfigurationInput,
) (*ErrorInfo, error)

UpdateCollectorConfigurationInputContext updates a collector configuration input with a context.

func (*Client) UpdateCollectorConfigurationOutput added in v0.7.0

func (client *Client) UpdateCollectorConfigurationOutput(
	id, outputID string, output *graylog.CollectorConfigurationOutput,
) (*ErrorInfo, error)

UpdateCollectorConfigurationOutput updates a collector configuration output.

func (*Client) UpdateCollectorConfigurationOutputContext added in v0.7.0

func (client *Client) UpdateCollectorConfigurationOutputContext(
	ctx context.Context, id, outputID string,
	output *graylog.CollectorConfigurationOutput,
) (*ErrorInfo, error)

UpdateCollectorConfigurationOutputContext updates a collector configuration output with a context.

func (*Client) UpdateCollectorConfigurationSnippet added in v0.7.0

func (client *Client) UpdateCollectorConfigurationSnippet(
	id, snippetID string, snippet *graylog.CollectorConfigurationSnippet,
) (*ErrorInfo, error)

UpdateCollectorConfigurationSnippet updates a collector configuration snippet.

func (*Client) UpdateCollectorConfigurationSnippetContext added in v0.7.0

func (client *Client) UpdateCollectorConfigurationSnippetContext(
	ctx context.Context, id, snippetID string,
	snippet *graylog.CollectorConfigurationSnippet,
) (*ErrorInfo, error)

UpdateCollectorConfigurationSnippetContext updates a collector configuration snippet with a context.

func (*Client) UpdateDashboard added in v0.4.0

func (client *Client) UpdateDashboard(prms *graylog.Dashboard) (*ErrorInfo, error)

UpdateDashboard updates a given dashboard.

func (*Client) UpdateDashboardContext added in v0.4.0

func (client *Client) UpdateDashboardContext(
	ctx context.Context, dashboard *graylog.Dashboard,
) (*ErrorInfo, error)

UpdateDashboardContext updates a given dashboard with a context.

func (*Client) UpdateIndexSet

func (client *Client) UpdateIndexSet(is *graylog.IndexSetUpdateParams) (*graylog.IndexSet, *ErrorInfo, error)

UpdateIndexSet updates a given Index Set.

func (*Client) UpdateIndexSetContext

func (client *Client) UpdateIndexSetContext(
	ctx context.Context, prms *graylog.IndexSetUpdateParams,
) (*graylog.IndexSet, *ErrorInfo, error)

UpdateIndexSetContext updates a given Index Set with a context.

func (*Client) UpdateInput

func (client *Client) UpdateInput(input *graylog.InputUpdateParams) (*graylog.Input, *ErrorInfo, error)

UpdateInput updates an given input.

func (*Client) UpdateInputContext

func (client *Client) UpdateInputContext(
	ctx context.Context, prms *graylog.InputUpdateParams,
) (*graylog.Input, *ErrorInfo, error)

UpdateInputContext updates an given input with a context.

func (*Client) UpdateLDAPGroupRoleMapping added in v0.10.0

func (client *Client) UpdateLDAPGroupRoleMapping(mapping map[string]string) (*ErrorInfo, error)

UpdateLDAPGroupRoleMapping updates the LDAP group and role mapping.

func (*Client) UpdateLDAPGroupRoleMappingContext added in v0.10.0

func (client *Client) UpdateLDAPGroupRoleMappingContext(ctx context.Context, mapping map[string]string) (*ErrorInfo, error)

UpdateLDAPGroupRoleMappingContext returns the LDAP group and role mapping with a context.

func (*Client) UpdateLDAPSetting added in v0.6.0

func (client *Client) UpdateLDAPSetting(ldapSetting *graylog.LDAPSetting) (
	*ErrorInfo, error,
)

UpdateLDAPSetting updates the LDAP setting.

func (*Client) UpdateLDAPSettingContext added in v0.6.0

func (client *Client) UpdateLDAPSettingContext(
	ctx context.Context, prms *graylog.LDAPSetting,
) (*ErrorInfo, error)

UpdateLDAPSettingContext updates the LDAP setting with a context.

func (*Client) UpdatePipelineRule added in v1.4.0

func (client *Client) UpdatePipelineRule(
	rule *graylog.PipelineRule,
) (*ErrorInfo, error)

UpdatePipelineRule updates a pipeline rule.

func (*Client) UpdatePipelineRuleContext added in v1.4.0

func (client *Client) UpdatePipelineRuleContext(
	ctx context.Context, rule *graylog.PipelineRule,
) (*ErrorInfo, error)

UpdatePipelineRuleContext updates a pipeline rule with a context.

func (*Client) UpdateRole

func (client *Client) UpdateRole(name string, role *graylog.RoleUpdateParams) (
	*graylog.Role, *ErrorInfo, error,
)

UpdateRole updates a given role.

func (*Client) UpdateRoleContext

func (client *Client) UpdateRoleContext(
	ctx context.Context, name string, prms *graylog.RoleUpdateParams,
) (*graylog.Role, *ErrorInfo, error)

UpdateRoleContext updates a given role with a context.

func (*Client) UpdateStream

func (client *Client) UpdateStream(stream *graylog.Stream) (*ErrorInfo, error)

UpdateStream updates a stream.

func (*Client) UpdateStreamAlarmCallback added in v1.1.0

func (client *Client) UpdateStreamAlarmCallback(ac *graylog.AlarmCallback) (*ErrorInfo, error)

UpdateStreamAlarmCallback modifies an alarm callback.

func (*Client) UpdateStreamAlarmCallbackContext added in v1.1.0

func (client *Client) UpdateStreamAlarmCallbackContext(
	ctx context.Context, ac *graylog.AlarmCallback,
) (*ErrorInfo, error)

UpdateStreamAlarmCallbackContext modifies an alarm callback with a context.

func (*Client) UpdateStreamAlertCondition added in v1.0.0

func (client *Client) UpdateStreamAlertCondition(streamID string, cond *graylog.AlertCondition) (*ErrorInfo, error)

UpdateStreamAlertCondition modifies an alert condition.

func (*Client) UpdateStreamAlertConditionContext added in v1.0.0

func (client *Client) UpdateStreamAlertConditionContext(
	ctx context.Context, streamID string, cond *graylog.AlertCondition,
) (*ErrorInfo, error)

UpdateStreamAlertConditionContext modifies an alert condition with a context.

func (*Client) UpdateStreamContext

func (client *Client) UpdateStreamContext(
	ctx context.Context, stream *graylog.Stream,
) (*ErrorInfo, error)

UpdateStreamContext updates a stream with a context.

func (*Client) UpdateStreamRule

func (client *Client) UpdateStreamRule(rule *graylog.StreamRule) (*ErrorInfo, error)

UpdateStreamRule updates a stream rule

func (*Client) UpdateStreamRuleContext

func (client *Client) UpdateStreamRuleContext(
	ctx context.Context, rule *graylog.StreamRule,
) (*ErrorInfo, error)

UpdateStreamRuleContext updates a stream rule

func (*Client) UpdateUser

func (client *Client) UpdateUser(prms *graylog.UserUpdateParams) (*ErrorInfo, error)

UpdateUser updates a given user.

func (*Client) UpdateUserContext

func (client *Client) UpdateUserContext(
	ctx context.Context, prms *graylog.UserUpdateParams,
) (*ErrorInfo, error)

UpdateUserContext updates a given user with a context.

type ErrorInfo

type ErrorInfo struct {
	Type     string         `json:"type"`
	Message  string         `json:"message"`
	Request  *http.Request  `json:"request"`
	Response *http.Response `json:"response"`
}

ErrorInfo represents Graylog API's error information. Basically Client methods (ex. CreateRole) returns this, but note that Response is closed.

Directories

Path Synopsis
Package endpoint provides Graylog API endpoints.
Package endpoint provides Graylog API endpoints.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL