Documentation ¶
Index ¶
- func Bool(v bool) *bool
- func CheckResponse(r *http.Response) error
- func String(v string) *string
- type AuthType
- type Client
- type ClientOptionFunc
- type CreateOrUpdateRoleOptions
- type CreateSpaceOptions
- type ElasticsearchIndex
- type ErrorResponse
- type Feature
- type GetAllSpacesOptions
- type Privilege
- type RequestOptionFunc
- type Response
- type Role
- type RolesService
- func (s RolesService) CreateOrUpdateRole(rName string, opt *CreateOrUpdateRoleOptions, options ...RequestOptionFunc) (*Role, *Response, error)
- func (s RolesService) DeleteRole(rName string, options ...RequestOptionFunc) (*Response, error)
- func (s RolesService) GetAllRoles(options ...RequestOptionFunc) ([]*Role, *Response, error)
- func (s RolesService) GetRole(rName string, options ...RequestOptionFunc) (*Role, *Response, error)
- type Space
- type SpacesService
- func (s SpacesService) CreateSpace(opt *CreateSpaceOptions, options ...RequestOptionFunc) (*Space, *Response, error)
- func (s SpacesService) DeleteSpace(sid string, options ...RequestOptionFunc) (*Response, error)
- func (s SpacesService) GetAllSpaces(opt *GetAllSpacesOptions, options ...RequestOptionFunc) ([]*Space, *Response, error)
- func (s SpacesService) GetSpace(sid string, options ...RequestOptionFunc) (*Space, *Response, error)
- func (s SpacesService) UpdateSpace(sid string, opt *UpdateSpaceOptions, options ...RequestOptionFunc) (*Space, *Response, error)
- type UpdateSpaceOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present
Types ¶
type AuthType ¶
type AuthType int
AuthType represents an authentication type within Kibana
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/api.html
List of available authentication types
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/api.html
type Client ¶
type Client struct { // User agent used when communicating with the Kibana API UserAgent string // Services used for talking to different parts of the Kibana API Roles *RolesService Spaces *SpacesService // contains filtered or unexported fields }
A Client manages communication with the Kibana API
func NewBasicAuthClient ¶
func NewBasicAuthClient(username, password string, options ...ClientOptionFunc) (*Client, error)
NewBasicAuthClient returns a new Kibana API client. To use API methods which require authentication, provide a valid username and password.
func NewClient ¶
func NewClient(apiKey string, options ...ClientOptionFunc) (*Client, error)
NewClient returns a new Kibana API client. To use API methods which require authentication, provide a valid API key
func (Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.
func (*Client) NewRequest ¶
func (c *Client) NewRequest(method, path string, opt interface{}, options []RequestOptionFunc) (*http.Request, error)
NewRequest creates a new API request. The method expects a relative URL path that will be resolved relative to the base URL of the Client. Relative URL paths should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
type ClientOptionFunc ¶
ClientOptionFunc can be used to customize a new Kibana API client
func WithBaseURL ¶
func WithBaseURL(urlStr string) ClientOptionFunc
WithBaseURL sets the base URL for API requests to a custom endpoint
type CreateOrUpdateRoleOptions ¶
type CreateOrUpdateRoleOptions struct { Metadata *struct { Version *int `url:"version,omitempty" json:"version,omitempty"` } `url:"metadata,omitempty" json:"metadata,omitempty"` Elasticsearch *struct { Cluster *[]string `url:"cluster,omitempty" json:"cluster,omitempty"` Indices *[]ElasticsearchIndex `url:"indices,omitempty" json:"indices,omitempty"` RunAs *[]string `url:"run_as,omitempty" json:"run_as,omitempty"` } `url:"elasticsearch,omitempty" json:"elasticsearch,omitempty"` Kibana *[]Privilege `url:"kibana" json:"kibana"` }
CreateOrUpdateRoleOptions represents the available CreateOrUpdateRole() options
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/role-management-api-put.html
type CreateSpaceOptions ¶
type CreateSpaceOptions struct { ID *string `url:"id" json:"id"` Name *string `url:"name" json:"name"` Description *string `url:"description,omitempty" json:"description,omitempty"` Color *string `url:"color,omitempty" json:"color,omitempty"` Initials *string `url:"initials,omitempty" json:"initials,omitempty"` DisabledFeatures *[]string `url:"disabledFeatures,omitempty" json:"disabledFeatures,omitempty"` ImageURL *string `url:"imageUrl,omitempty" json:"imageUrl,omitempty"` }
CreateSpaceOptions represents the available CreateSpace() options
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/spaces-api-post.html
type ElasticsearchIndex ¶
type ElasticsearchIndex struct { Names []string `json:"names"` Privileges []string `json:"privileges"` FieldSecurity struct { Grant []string `json:"grant"` Except []string `json:"except"` } `json:"field_security"` // TODO: Query AllowRestrictedIndices bool `json:"allow_restricted_indices"` }
ElasticsearchIndex represents an Elasticsearch index privilege
Elasticsearch API docs: https://www.elastic.co/guide/en/elasticsearch/reference/7.17/defining-roles.html
type ErrorResponse ¶
An ErrorResponse reports one or more errors caused by an API request
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type Feature ¶
type Feature struct { Discover []string `json:"discover,omitempty"` Visualize []string `json:"visualize,omitempty"` Dashboard []string `json:"dashboard,omitempty"` DevTools []string `json:"dev_tools,omitempty"` AdvancedSettings []string `json:"advancedSettings,omitempty"` IndexPatterns []string `json:"indexPatterns,omitempty"` Graph []string `json:"graph,omitempty"` APM []string `json:"apm,omitempty"` Maps []string `json:"maps,omitempty"` Canvas []string `json:"canvas,omitempty"` Infrastructure []string `json:"infrastructure,omitempty"` Logs []string `json:"logs,omitempty"` Uptime []string `json:"uptime,omitempty"` }
Feature represents a single Kibana feature privileges
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/kibana-privileges.html
type GetAllSpacesOptions ¶
type GetAllSpacesOptions struct { Purpose *string `url:"purpose,omitempty" json:"purpose,omitempty"` IncludeAuthorizedPurpose *bool `url:"include_authorized_purpose,omitempty" json:"include_authorized_purpose,omitempty"` }
GetAllSpacesOptions represents the available ListAllSpaces() options
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/spaces-api-get-all.html
type Privilege ¶
type Privilege struct { Base []string `json:"base"` Feature *Feature `json:"feature"` Spaces []string `json:"spaces"` }
Privilege represents a Kibana feature privilege
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/kibana-privileges.html
type RequestOptionFunc ¶
RequestOptionFunc can be passed to all API requests to customize the API request
type Response ¶
Response is a Kibana API response. This wraps the standard http.Response returned from Kibana
type Role ¶
type Role struct { Name string `json:"name"` Metadata struct { Version int `json:"version"` } `json:"metadata"` TransientMetadata struct { Enabled bool `json:"enabled"` } `json:"transient_metadata"` Elasticsearch struct { Cluster []string `json:"cluster"` Indices *[]ElasticsearchIndex `json:"indices"` RunAs []string `json:"run_as"` } `json:"elasticsearch"` Kibana *[]Privilege `json:"kibana"` }
Role represents a Kibana Role
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/role-management-api.html
type RolesService ¶
type RolesService struct {
// contains filtered or unexported fields
}
RolesService handles communication with the roles related methods of the Kibana API
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/role-management-api.html
func (RolesService) CreateOrUpdateRole ¶
func (s RolesService) CreateOrUpdateRole(rName string, opt *CreateOrUpdateRoleOptions, options ...RequestOptionFunc) (*Role, *Response, error)
CreateOrUpdateRole creates or updates a Kibana role
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/role-management-api-put.html
func (RolesService) DeleteRole ¶
func (s RolesService) DeleteRole(rName string, options ...RequestOptionFunc) (*Response, error)
DeleteRole deletes a single Kibana role
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/role-management-api-delete.html
func (RolesService) GetAllRoles ¶
func (s RolesService) GetAllRoles(options ...RequestOptionFunc) ([]*Role, *Response, error)
GetAllRoles lists all Kibana roles
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/role-management-api-get.html
func (RolesService) GetRole ¶
func (s RolesService) GetRole(rName string, options ...RequestOptionFunc) (*Role, *Response, error)
GetRole lists a single Kibana role
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/role-management-specific-api-get.html
type Space ¶
type Space struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Color string `json:"color"` Initials string `json:"initials"` DisabledFeatures []string `json:"disabledFeatures"` ImageURL string `json:"imageUrl"` }
Space represents a Kibana Space
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/spaces-api.html
type SpacesService ¶
type SpacesService struct {
// contains filtered or unexported fields
}
SpacesService handles communication with the spaces related methods of the Kibana API
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/spaces-api.html
func (SpacesService) CreateSpace ¶
func (s SpacesService) CreateSpace(opt *CreateSpaceOptions, options ...RequestOptionFunc) (*Space, *Response, error)
CreateSpace creates a Kibana space
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/spaces-api-post.html
func (SpacesService) DeleteSpace ¶
func (s SpacesService) DeleteSpace(sid string, options ...RequestOptionFunc) (*Response, error)
DeleteSpace deletes a single Kibana space
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/spaces-api-delete.html
func (SpacesService) GetAllSpaces ¶
func (s SpacesService) GetAllSpaces(opt *GetAllSpacesOptions, options ...RequestOptionFunc) ([]*Space, *Response, error)
GetAllSpaces lists all the available Kibana spaces
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/spaces-api-get-all.html
func (SpacesService) GetSpace ¶
func (s SpacesService) GetSpace(sid string, options ...RequestOptionFunc) (*Space, *Response, error)
GetSpace lists a single Kibana space
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/spaces-api-get.html
func (SpacesService) UpdateSpace ¶
func (s SpacesService) UpdateSpace(sid string, opt *UpdateSpaceOptions, options ...RequestOptionFunc) (*Space, *Response, error)
UpdateSpace updates a Kibana space
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/spaces-api-put.html
type UpdateSpaceOptions ¶
type UpdateSpaceOptions struct { ID *string `url:"id" json:"id"` Name *string `url:"name" json:"name"` Description *string `url:"description,omitempty" json:"description,omitempty"` Color *string `url:"color,omitempty" json:"color,omitempty"` Initials *string `url:"initials,omitempty" json:"initials,omitempty"` DisabledFeatures *[]string `url:"disabledFeatures,omitempty" json:"disabledFeatures,omitempty"` ImageURL *string `url:"imageUrl,omitempty" json:"imageUrl,omitempty"` }
UpdateSpaceOptions represents the available UpdateSpace() options
Kibana API docs: https://www.elastic.co/guide/en/kibana/current/spaces-api-put.html