client

package
v11.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2020 License: MIT Imports: 12 Imported by: 0

README

go-graylog client

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 (
	"context"
	"fmt"
	"log"
	"net/http"

	"github.com/suzuki-shunsuke/flute/flute"

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

func main() {
	ctx := context.Background()

	// Create a client
	cl, err := client.NewClient("http://example.com/api", "admin", "admin")
	if err != nil {
		log.Fatal(err)
	}

	setExampleMock(cl)

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

func setExampleMock(cl *client.Client) {
	cl.SetHTTPClient(&http.Client{
		Transport: &flute.Transport{
			Services: []flute.Service{
				{
					Endpoint: "http://example.com",
					Routes: []flute.Route{
						{
							Tester: &flute.Tester{
								Method:       "GET",
								Path:         "/api/roles/Admin",
								PartOfHeader: getTestHeader(),
							},
							Response: &flute.Response{
								Base: http.Response{
									StatusCode: 200,
								},
								BodyString: `{
  "name": "Admin",
  "description": "Grants all permissions for Graylog administrators (built-in)",
  "permissions": [
    "*"
  ],
  "read_only": true
}`,
							},
						},
					},
				},
			},
		},
	})
}
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 NewClientV3

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

NewClientV3 returns a new Graylog v3 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(
	ctx context.Context, userName, roleName string,
) (*ErrorInfo, error)

AddUserToRole adds a user to a role.

func (*Client) ConnectPipelinesToStream

func (client *Client) ConnectPipelinesToStream(
	ctx context.Context, conn *graylog.PipelineConnection,
) (*ErrorInfo, error)

ConnectStreamsToPipeline connects processing pipelines to a stream.

func (*Client) ConnectStreamsToPipeline

func (client *Client) ConnectStreamsToPipeline(
	ctx context.Context, pipelineID string, streamIDs []string,
) ([]graylog.PipelineConnection, *ErrorInfo, error)

ConnectStreamsToPipeline connects streams to a pipeline.

func (*Client) CreateCollectorConfiguration

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

CreateCollectorConfiguration creates a collector configuration.

func (*Client) CreateCollectorConfigurationInput

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

CreateCollectorConfigurationInput creates a collector configuration input.

func (*Client) CreateCollectorConfigurationOutput

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

CreateCollectorConfigurationOutput creates a collector configuration output.

func (*Client) CreateCollectorConfigurationSnippet

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

CreateCollectorConfigurationSnippet creates a collector configuration snippet.

func (*Client) CreateDashboard

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

CreateDashboard creates a new dashboard account.

func (*Client) CreateDashboardWidget

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

CreateDashboardWidget creates a new dashboard widget.

func (*Client) CreateEventDefinition

func (client *Client) CreateEventDefinition(
	ctx context.Context, definition *graylog.EventDefinition,
) (*ErrorInfo, error)

CreateEventDefinition creates a new event definition.

func (*Client) CreateEventNotification

func (client *Client) CreateEventNotification(
	ctx context.Context, notif *graylog.EventNotification,
) (*ErrorInfo, error)

CreateEventNotification creates a new event notification.

func (*Client) CreateExtractor

func (client *Client) CreateExtractor(
	ctx context.Context, inputID string, extractor *graylog.Extractor,
) (
	*ErrorInfo, error,
)

CreateExtractor adds an extractor to an input.

func (*Client) CreateGrokPattern

func (client *Client) CreateGrokPattern(
	ctx context.Context, grokPattern *graylog.GrokPattern,
) (*ErrorInfo, error)

CreateGrokPattern creates a new grok pattern.

func (*Client) CreateIndexSet

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

CreateIndexSet creates a Index Set.

func (*Client) CreateInput

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

CreateInput creates an input.

func (*Client) CreateInputStaticField

func (client *Client) CreateInputStaticField(
	ctx context.Context, inputID, key, value string,
) (ei *ErrorInfo, err error)

CreateInputStaticField creates an input static field.

func (*Client) CreateOutput

func (client *Client) CreateOutput(
	ctx context.Context, output *graylog.Output,
) (*ErrorInfo, error)

CreateOutput creates a new output.

func (*Client) CreatePipeline

func (client *Client) CreatePipeline(
	ctx context.Context, pipeline *graylog.Pipeline,
) (*ErrorInfo, error)

CreatePipeline creates a pipeline.

func (*Client) CreatePipelineRule

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

CreatePipelineRule creates a pipeline rule.

func (*Client) CreateRole

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

CreateRole creates a new role.

func (*Client) CreateStream

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

CreateStream creates a stream.

func (*Client) CreateStreamAlarmCallback

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

CreateStreamAlarmCallback creates an alarm callback.

func (*Client) CreateStreamAlertCondition

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

CreateStreamAlertCondition creates an alert condition.

func (*Client) CreateStreamOutputs

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

CreateOutput creates a new output.

func (*Client) CreateStreamRule

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

CreateStreamRule creates a stream.

func (*Client) CreateUser

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

CreateUser creates a new user account.

func (*Client) CreateUserToken added in v11.1.0

func (client *Client) CreateUserToken(
	ctx context.Context, userName, tokenName string,
) (*graylog.UserToken, *ErrorInfo, error)

CreateUserToken generates a new access token for a user

func (*Client) DeleteCollectorConfiguration

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

DeleteCollectorConfiguration deletes a collector configuration.

func (*Client) DeleteCollectorConfigurationInput

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

DeleteCollectorConfigurationInput deletes a collector configuration input.

func (*Client) DeleteCollectorConfigurationOutput

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

DeleteCollectorConfigurationOutput deletes a collector configuration output.

func (*Client) DeleteCollectorConfigurationSnippet

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

DeleteCollectorConfigurationSnippet deletes a collector configuration snippet.

func (*Client) DeleteDashboard

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

DeleteDashboard deletes a given dashboard.

func (*Client) DeleteDashboardWidget

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

DeleteDashboardWidget deletes a given dashboard widget.

func (*Client) DeleteEventDefinition

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

DeleteEventDefinition deletes a given event definition.

func (*Client) DeleteEventNotification

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

DeleteEventNotification deletes a given event notification.

func (*Client) DeleteExtractor

func (client *Client) DeleteExtractor(
	ctx context.Context, inputID, extractorID string,
) (
	*ErrorInfo, error,
)

DeleteExtractor updates an extractor.

func (*Client) DeleteGrokPattern

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

DeleteGrokPattern deletes a given grok pattern.

func (*Client) DeleteIndexSet

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

DeleteIndexSet deletes a given Index Set.

func (*Client) DeleteInput

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

DeleteInput deletes an given input.

func (*Client) DeleteInputStaticField

func (client *Client) DeleteInputStaticField(
	ctx context.Context, inputID, key string,
) (*ErrorInfo, error)

DeleteInputStaticField deletes an given input static field.

func (*Client) DeleteLDAPSetting

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

DeleteLDAPSetting deletes the LDAP setting.

func (*Client) DeleteOutput

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

DeleteOutput deletes a given output.

func (*Client) DeletePipeline

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

DeletePipeline deletes a pipeline.

func (*Client) DeletePipelineRule

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

DeletePipelineRule deletes a pipeline rule.

func (*Client) DeleteRole

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

DeleteRole deletes a given role.

func (*Client) DeleteStream

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

DeleteStream deletes a stream.

func (*Client) DeleteStreamAlarmCallback

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

DeleteStreamAlarmCallback deletes an alarm callback.

func (*Client) DeleteStreamAlertCondition

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

DeleteStreamAlertCondition deletes an alert condition.

func (*Client) DeleteStreamOutput

func (client *Client) DeleteStreamOutput(
	ctx context.Context, streamID, outputID string,
) (*ErrorInfo, error)

DeleteOutput deletes a given output.

func (*Client) DeleteStreamRule

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

DeleteStreamRule deletes a stream rule.

func (*Client) DeleteUser

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

DeleteUser deletes a given user.

func (*Client) DeleteUserToken added in v11.1.0

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

DeleteUserToken removes a token for a user.

func (*Client) Endpoints

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

Endpoints returns endpoints.

func (*Client) GetAlarmCallbacks

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

GetAlarmCallbacksContext returns all alarm callbacks.

func (*Client) GetAlert

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

GetAlert returns an alert.

func (*Client) GetAlertConditions

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

GetAlertConditions returns all alert conditions.

func (*Client) GetAlerts

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

GetAlerts returns all alerts.

func (*Client) GetCollectorConfiguration

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

GetCollectorConfiguration returns a given user.

func (*Client) GetCollectorConfigurations

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

GetCollectorConfigurations returns all collector configurations.

func (*Client) GetDashboard

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

GetDashboard returns a given dashboard.

func (*Client) GetDashboardWidget

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

GetDashboardWidget gets a dashboard widget.

func (*Client) GetDashboards

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

GetDashboards returns all dashboards.

func (*Client) GetEnabledStreams

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

GetEnabledStreams returns all enabled streams.

func (*Client) GetEventDefinition

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

GetEventDefinition returns a given event definition.

func (*Client) GetEventDefinitions

func (client *Client) GetEventDefinitions(ctx context.Context) (
	*graylog.EventDefinitionsBody, *ErrorInfo, error,
)

GetEventDefinitions returns all event definitions.

func (*Client) GetEventNotification

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

GetEventNotification returns a given event notification.

func (*Client) GetEventNotifications

func (client *Client) GetEventNotifications(ctx context.Context) (
	*graylog.EventNotificationsBody, *ErrorInfo, error,
)

GetEventNotifications returns all event notifications.

func (*Client) GetExtractor

func (client *Client) GetExtractor(
	ctx context.Context, inputID, extractorID string,
) (
	*graylog.Extractor, *ErrorInfo, error,
)

GetExtractor returns an extractor.

func (*Client) GetExtractors

func (client *Client) GetExtractors(ctx context.Context, inputID string) (
	[]graylog.Extractor, int, *ErrorInfo, error,
)

GetExtractors returns all extractors.

func (*Client) GetGrokPattern

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

GetGrokPattern returns a given grok pattern.

func (*Client) GetGrokPatterns

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

GetGrokPatterns returns all grok patterns.

func (*Client) GetIndexSet

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

GetIndexSet returns a given index set.

func (*Client) GetIndexSetStats

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

GetIndexSetStats returns a given Index Set statistics.

func (*Client) GetIndexSets

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

GetIndexSets returns a list of all index sets.

func (*Client) GetInput

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

GetInput returns a given input.

func (*Client) GetInputs

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

GetInputs returns all inputs.

func (*Client) GetLDAPGroupRoleMapping

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

GetLDAPGroupRoleMapping returns the LDAP group and role mapping.

func (*Client) GetLDAPGroups

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

GetLDAPGroups returns the available LDAP groups.

func (*Client) GetLDAPSetting

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

GetLDAPSetting returns the LDAP setting.

func (*Client) GetOutput

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

GetOutput returns a given output.

func (*Client) GetOutputs

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

GetOutputs returns all outputs.

func (*Client) GetPipeline

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

GetPipeline returns a pipeline.

func (*Client) GetPipelineConnections

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

GetPipelineConnections returns all pipeline connections.

func (*Client) GetPipelineConnectionsOfStream

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

GetPipeline returns a pipeline connection for a given stream.

func (*Client) GetPipelineRule

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

GetPipelineRule returns a pipeline rule.

func (*Client) GetPipelineRules

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

GetPipelineRules returns all pipeline rules.

func (*Client) GetPipelines

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

GetPipelines returns all pipeline.

func (*Client) GetRole

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

GetRole returns a given role.

func (*Client) GetRoleMembers

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

GetRoleMembers returns a given role's members.

func (*Client) GetRoles

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

GetRoles returns all roles.

func (*Client) GetStream

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

GetStream returns a given stream.

func (*Client) GetStreamAlarmCallback

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

GetStreamAlarmCallback gets an alarm callback.

func (*Client) GetStreamAlarmCallbacks

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

GetStreamAlarmCallbacks gets all alarm callbacks of this stream.

func (*Client) GetStreamAlertCondition

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

GetStreamAlertCondition gets an alert condition.

func (*Client) GetStreamAlertConditions

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

GetStreamAlertConditions gets all alert conditions of this stream.

func (*Client) GetStreamOutputs

func (client *Client) GetStreamOutputs(ctx context.Context, streamID string) (
	[]graylog.Output, int, *ErrorInfo, error,
)

GetOutputs returns all outputs.

func (*Client) GetStreamRule

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

GetStreamRule returns a stream rule.

func (*Client) GetStreamRuleTypes

func (client *Client) GetStreamRuleTypes(
	ctx context.Context, streamID string,
) ([]graylog.StreamRuleType, *ErrorInfo, error)

GetStreamRuleTypes returns all available stream rule types.

func (*Client) GetStreamRules

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

GetStreamRules returns a list of all stream rules.

func (*Client) GetStreams

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

GetStreams returns all streams.

func (*Client) GetTotalIndexSetsStats

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

GetTotalIndexSetsStats returns stats of all Index Sets.

func (*Client) GetUser

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

GetUser returns a given user.

func (*Client) GetUserTokens added in v11.1.0

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

GetUserTokens returns the list of access tokens for a user.

func (*Client) GetUsers

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

GetUsers returns all users.

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(
	ctx context.Context, id string,
) (*ErrorInfo, error)

PauseStream pauses a stream.

func (*Client) RemoveUserFromRole

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

RemoveUserFromRole removes a user from a role.

func (*Client) RenameCollectorConfiguration

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

RenameCollectorConfiguration renames a collector configuration.

func (*Client) ResumeStream

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

ResumeStream resumes a stream.

func (*Client) SetDefaultIndexSet

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

SetDefaultIndexSet sets default Index Set.

func (*Client) SetHTTPClient

func (client *Client) SetHTTPClient(c *http.Client)

SetHTTPClient sets a custom *http.Client. If you don't set *http.Client by this method, the default value is http.DefaultClient.

func (*Client) SetXRequestedBy

func (client *Client) SetXRequestedBy(x string)

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

func (*Client) UpdateCollectorConfigurationInput

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

UpdateCollectorConfigurationInput updates a collector configuration input.

func (*Client) UpdateCollectorConfigurationOutput

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

UpdateCollectorConfigurationOutput updates a collector configuration output.

func (*Client) UpdateCollectorConfigurationSnippet

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

UpdateCollectorConfigurationSnippet updates a collector configuration snippet.

func (*Client) UpdateDashboard

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

UpdateDashboard updates a given dashboard.

func (*Client) UpdateDashboardWidget

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

UpdateDashboardWidget creates an existing dashboard widget.

func (*Client) UpdateDashboardWidgetCacheTime

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

UpdateDashboardWidgetCacheTime updates an existing dashboard widget cache time.

func (*Client) UpdateDashboardWidgetDescription

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

UpdateDashboardWidgetDescription updates an existing dashboard widget description.

func (*Client) UpdateDashboardWidgetPositions

func (client *Client) UpdateDashboardWidgetPositions(
	ctx context.Context, dashboardID string,
	positions []graylog.DashboardWidgetPosition,
) (*ErrorInfo, error)

UpdateDashboardWidgetPositions updates the positions of dashboard widgets.

func (*Client) UpdateEventDefinition

func (client *Client) UpdateEventDefinition(
	ctx context.Context, definition *graylog.EventDefinition,
) (*ErrorInfo, error)

UpdateEventDefinition updates a given event definition.

func (*Client) UpdateEventNotification

func (client *Client) UpdateEventNotification(
	ctx context.Context, notif *graylog.EventNotification,
) (*ErrorInfo, error)

UpdateEventNotification updates a given event notification.

func (*Client) UpdateExtractor

func (client *Client) UpdateExtractor(
	ctx context.Context, inputID string, extractor *graylog.Extractor,
) (
	*ErrorInfo, error,
)

UpdateExtractor updates an extractor.

func (*Client) UpdateGrokPattern

func (client *Client) UpdateGrokPattern(
	ctx context.Context, grokPattern *graylog.GrokPattern,
) (*ErrorInfo, error)

UpdateGrokPattern updates a given grok pattern.

func (*Client) UpdateIndexSet

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

UpdateIndexSet updates a given Index Set.

func (*Client) UpdateInput

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

UpdateInput updates an given input.

func (*Client) UpdateLDAPGroupRoleMapping

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

UpdateLDAPGroupRoleMapping returns the LDAP group and role mapping.

func (*Client) UpdateLDAPSetting

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

UpdateLDAPSetting updates the LDAP setting.

func (*Client) UpdateOutput

func (client *Client) UpdateOutput(
	ctx context.Context, output *graylog.Output,
) (*ErrorInfo, error)

UpdateOutput updates a given output.

func (*Client) UpdatePipeline

func (client *Client) UpdatePipeline(
	ctx context.Context, pipeline *graylog.Pipeline,
) (*ErrorInfo, error)

UpdatePipeline updates a pipeline.

func (*Client) UpdatePipelineRule

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

UpdatePipelineRule updates a pipeline rule.

func (*Client) UpdateRole

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

UpdateRole updates a given role.

func (*Client) UpdateStream

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

UpdateStream updates a stream.

func (*Client) UpdateStreamAlarmCallback

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

UpdateStreamAlarmCallback modifies an alarm callback.

func (*Client) UpdateStreamAlertCondition

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

UpdateStreamAlertCondition modifies an alert condition.

func (*Client) UpdateStreamRule

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

UpdateStreamRule updates a stream rule

func (*Client) UpdateUser

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

UpdateUser updates a given user.

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