splunk

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Localhost    = "localhost"
	BaseURL      = "https://%s:8089"
	CloudBaseURL = "https://%s.splunkcloud.com:8089"

	UsersBaseURL        = "/services/authentication/users"
	UserBaseURL         = "/services/authentication/users/%s"
	RolesBaseURL        = "/services/authorization/roles"
	RoleBaseURL         = "/services/authorization/roles/%s"
	CapabilitiesBaseURL = "/services/authorization/grantable_capabilities/capabilities"
	ApplicationsBaseURL = "/services/apps/local"
	ApplicationBaseURL  = "/services/apps/local/%s"

	RolesField        = "roles"
	CapabilitiesField = "capabilities"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ACL

type ACL struct {
	App   string `json:"app"`
	Perms struct {
		Read  []string `json:"read"`
		Write []string `json:"write"`
	} `json:"perms"`
}

type Application

type Application struct {
	BaseResource
	Name    string `json:"name"`
	Author  string `json:"author"`
	Content struct {
		Description string `json:"description"`
	} `json:"content"`
}

type BaseResource

type BaseResource struct {
	Id  string `json:"id"`
	ACL ACL    `json:"acl"`
}

type Capability

type Capability struct {
	BaseResource
	Name    string `json:"name"`
	Content struct {
		Capabilities []string `json:"capabilities"`
	} `json:"content"`
}

type Client

type Client struct {
	Auth       string
	Cloud      bool
	Deployment string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client, auth string, cloud bool) *Client

func (*Client) CreateUrl

func (c *Client) CreateUrl(endpoint string) string

GetUrl returns the full URL for the given endpoint based on platform.

func (*Client) GetApplication

func (c *Client) GetApplication(ctx context.Context, applicationName string) (*Application, error)

GetApplication returns specific application under Splunk instance.

func (*Client) GetApplications

func (c *Client) GetApplications(ctx context.Context, getApplicationsVars PaginationVars) ([]Application, string, error)

GetApplications returns all applications under specific Splunk instance.

func (*Client) GetCapabilities

func (c *Client) GetCapabilities(ctx context.Context, getCapabilitiesVars PaginationVars) ([]Capability, string, error)

GetCapabilities returns all grantable capabilities under specific Splunk instance.

func (*Client) GetRole added in v0.0.2

func (c *Client) GetRole(ctx context.Context, roleId string) (*Role, error)

GetRole returns information regarding one specific role under Splunk instance.

func (*Client) GetRoles

func (c *Client) GetRoles(ctx context.Context, getRolesVars PaginationVars) ([]Role, string, error)

GetRoles returns all roles under specific Splunk instance.

func (*Client) GetUser added in v0.0.2

func (c *Client) GetUser(ctx context.Context, userId string) (*User, error)

GetUser returns information regarding one specific user under Splunk instance.

func (*Client) GetUsers

func (c *Client) GetUsers(ctx context.Context, getUsersVars PaginationVars) ([]User, string, error)

GetUsers returns all users under specific Splunk instance.

func (*Client) GetUsersByRole

func (c *Client) GetUsersByRole(ctx context.Context, getUsersVars PaginationVars, role string) ([]User, string, error)

GetUsersByRole returns all users in some specific role under one Splunk instance.

func (*Client) IsCloudPlatform

func (c *Client) IsCloudPlatform() bool

func (*Client) PointToDeployment

func (c *Client) PointToDeployment(deployment string)

func (*Client) PointToLocalhost

func (c *Client) PointToLocalhost()

func (*Client) ResetPointer

func (c *Client) ResetPointer()

func (*Client) UpdateRoleCapabilities added in v0.0.2

func (c *Client) UpdateRoleCapabilities(ctx context.Context, roleId string, capabilities []string) error

UpdateRoleCapabilities updates capabilities of a specific role under Splunk instance.

func (*Client) UpdateUserRoles added in v0.0.2

func (c *Client) UpdateUserRoles(ctx context.Context, userId string, roles []string) error

UpdateUserRoles updates roles of a specific user under Splunk instance.

type PaginationData

type PaginationData struct {
	Total   int `json:"total"`
	PerPage int `json:"perPage"`
	Offset  int `json:"offset"`
}

type PaginationVars

type PaginationVars struct {
	Limit int
	Page  string
}

type Response

type Response[T any] struct {
	Values         []T `json:"entry"`
	PaginationData `json:"paging"`
}

type Role

type Role struct {
	BaseResource
	Name    string `json:"name"`
	Author  string `json:"author"`
	Content struct {
		Capabilities         []string `json:"capabilities"`
		ImportedCapabilities []string `json:"imported_capabilities"`
	} `json:"content"`
}

type User

type User struct {
	BaseResource
	Name    string `json:"name"`
	Content struct {
		Email        string   `json:"email"`
		Roles        []string `json:"roles"`
		Capabilities []string `json:"capabilities"`
	} `json:"content"`
}

Jump to

Keyboard shortcuts

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