Documentation ¶
Index ¶
- Variables
- func ApplyListOptions(request *resty.Request, options *ListOptions)
- func CreateBasePath(group, version string, resType ...string) func(...string) string
- func UnmarshalError(res *resty.Response) error
- type APIClient
- type APIError
- type AssetAPIClient
- type AuthenticationAPIClient
- type CheckAPIClient
- type ClusterMemberClient
- type ClusterRoleAPIClient
- type ClusterRoleBindingAPIClient
- type EntityAPIClient
- type EventAPIClient
- type ExtensionAPIClient
- type FilterAPIClient
- type GenericClient
- type HandlerAPIClient
- type HealthAPIClient
- type HookAPIClient
- type LicenseClient
- type ListOptions
- type MutatorAPIClient
- type NamespaceAPIClient
- type RestClient
- func (client *RestClient) AddCheckHook(check *types.CheckConfig, checkHook *types.HookList) error
- func (client *RestClient) AddGroupToUser(username, group string) error
- func (client *RestClient) ClearAuthToken()
- func (client *RestClient) CreateAccessToken(url, userid, password string) (*types.Tokens, error)
- func (client *RestClient) CreateAsset(asset *types.Asset) error
- func (client *RestClient) CreateCheck(check *types.CheckConfig) (err error)
- func (client *RestClient) CreateClusterRole(clusterRole *types.ClusterRole) error
- func (client *RestClient) CreateClusterRoleBinding(clusterRoleBinding *types.ClusterRoleBinding) error
- func (client *RestClient) CreateEntity(entity *types.Entity) (err error)
- func (client *RestClient) CreateFilter(filter *types.EventFilter) (err error)
- func (client *RestClient) CreateHandler(handler *types.Handler) (err error)
- func (client *RestClient) CreateHook(hook *types.HookConfig) (err error)
- func (client *RestClient) CreateMutator(mutator *types.Mutator) (err error)
- func (client *RestClient) CreateNamespace(namespace *types.Namespace) error
- func (client *RestClient) CreateRole(role *types.Role) error
- func (client *RestClient) CreateRoleBinding(roleBinding *types.RoleBinding) error
- func (client *RestClient) CreateSilenced(silenced *types.Silenced) error
- func (client *RestClient) CreateUser(user *types.User) error
- func (client *RestClient) Delete(path string) error
- func (client *RestClient) DeleteCheck(namespace, name string) error
- func (client *RestClient) DeleteClusterRole(name string) error
- func (client *RestClient) DeleteClusterRoleBinding(name string) error
- func (client *RestClient) DeleteEntity(namespace, name string) (err error)
- func (client *RestClient) DeleteEvent(namespace, entity, check string) error
- func (client *RestClient) DeleteFilter(namespace, name string) error
- func (client *RestClient) DeleteHandler(namespace, name string) (err error)
- func (client *RestClient) DeleteHook(namespace, name string) error
- func (client *RestClient) DeleteMutator(namespace, name string) (err error)
- func (client *RestClient) DeleteNamespace(namespace string) error
- func (client *RestClient) DeleteRole(namespace, name string) error
- func (client *RestClient) DeleteRoleBinding(namespace, name string) error
- func (client *RestClient) DeleteSilenced(namespace, name string) error
- func (client *RestClient) DeregisterExtension(name, namespace string) error
- func (client *RestClient) DisableUser(username string) error
- func (client *RestClient) ExecuteCheck(req *types.AdhocRequest) error
- func (client *RestClient) FetchAsset(name string) (*types.Asset, error)
- func (client *RestClient) FetchCheck(name string) (*types.CheckConfig, error)
- func (c *RestClient) FetchClusterID() (string, error)
- func (client *RestClient) FetchClusterRole(name string) (*types.ClusterRole, error)
- func (client *RestClient) FetchClusterRoleBinding(name string) (*types.ClusterRoleBinding, error)
- func (client *RestClient) FetchEntity(name string) (*types.Entity, error)
- func (client *RestClient) FetchEvent(entity, check string) (*types.Event, error)
- func (client *RestClient) FetchFilter(name string) (*types.EventFilter, error)
- func (client *RestClient) FetchHandler(name string) (*types.Handler, error)
- func (client *RestClient) FetchHook(name string) (*types.HookConfig, error)
- func (client *RestClient) FetchLicense() (interface{}, error)
- func (client *RestClient) FetchMutator(name string) (*types.Mutator, error)
- func (client *RestClient) FetchNamespace(namespaceName string) (*types.Namespace, error)
- func (client *RestClient) FetchRole(name string) (*types.Role, error)
- func (client *RestClient) FetchRoleBinding(name string) (*types.RoleBinding, error)
- func (client *RestClient) FetchSilenced(name string) (*types.Silenced, error)
- func (client *RestClient) FetchUser(username string) (*types.User, error)
- func (client *RestClient) Get(path string, obj interface{}) error
- func (c *RestClient) Health() (*types.HealthResponse, error)
- func (client *RestClient) List(path string, objs interface{}, options *ListOptions) error
- func (client *RestClient) ListAssets(namespace string, options *ListOptions) ([]corev2.Asset, error)
- func (client *RestClient) ListChecks(namespace string, options *ListOptions) ([]corev2.CheckConfig, error)
- func (client *RestClient) ListClusterRoleBindings(options *ListOptions) ([]corev2.ClusterRoleBinding, error)
- func (client *RestClient) ListClusterRoles(options *ListOptions) ([]corev2.ClusterRole, error)
- func (client *RestClient) ListEntities(namespace string, options *ListOptions) ([]corev2.Entity, error)
- func (client *RestClient) ListEvents(namespace string, options *ListOptions) ([]corev2.Event, error)
- func (client *RestClient) ListExtensions(namespace string, options *ListOptions) ([]corev2.Extension, error)
- func (client *RestClient) ListFilters(namespace string, options *ListOptions) ([]corev2.EventFilter, error)
- func (client *RestClient) ListHandlers(namespace string, options *ListOptions) ([]corev2.Handler, error)
- func (client *RestClient) ListHooks(namespace string, options *ListOptions) ([]corev2.HookConfig, error)
- func (client *RestClient) ListMutators(namespace string, options *ListOptions) ([]corev2.Mutator, error)
- func (client *RestClient) ListNamespaces(options *ListOptions) ([]corev2.Namespace, error)
- func (client *RestClient) ListRoleBindings(namespace string, options *ListOptions) ([]corev2.RoleBinding, error)
- func (client *RestClient) ListRoles(namespace string, options *ListOptions) ([]corev2.Role, error)
- func (client *RestClient) ListSilenceds(namespace, sub, check string, options *ListOptions) ([]corev2.Silenced, error)
- func (client *RestClient) ListUsers(options *ListOptions) ([]corev2.User, error)
- func (client *RestClient) Logout(token string) error
- func (c *RestClient) MemberAdd(peerAddrs []string) (*clientv3.MemberAddResponse, error)
- func (c *RestClient) MemberList() (*clientv3.MemberListResponse, error)
- func (c *RestClient) MemberRemove(id uint64) (*clientv3.MemberRemoveResponse, error)
- func (c *RestClient) MemberUpdate(id uint64, peerAddrs []string) (*clientv3.MemberUpdateResponse, error)
- func (client *RestClient) Post(path string, obj interface{}) error
- func (client *RestClient) Put(path string, obj interface{}) error
- func (client *RestClient) PutResource(r types.Wrapper) error
- func (client *RestClient) R() *resty.Request
- func (client *RestClient) RefreshAccessToken(token string) (*types.Tokens, error)
- func (client *RestClient) RegisterExtension(extension *types.Extension) error
- func (client *RestClient) ReinstateUser(username string) error
- func (client *RestClient) RemoveAllGroupsFromUser(username string) error
- func (client *RestClient) RemoveCheckHook(check *types.CheckConfig, checkHookType string, hookName string) error
- func (client *RestClient) RemoveGroupFromUser(username, group string) error
- func (client *RestClient) Reset()
- func (client *RestClient) ResolveEvent(event *types.Event) error
- func (client *RestClient) SetGroupsForUser(username string, groups []string) error
- func (client *RestClient) SetTLSClientConfig(c *tls.Config)
- func (client *RestClient) TestCreds(userid, password string) error
- func (client *RestClient) UpdateAsset(asset *types.Asset) (err error)
- func (client *RestClient) UpdateCheck(check *types.CheckConfig) (err error)
- func (client *RestClient) UpdateEntity(entity *types.Entity) (err error)
- func (client *RestClient) UpdateEvent(event *types.Event) error
- func (client *RestClient) UpdateFilter(f *types.EventFilter) error
- func (client *RestClient) UpdateHandler(handler *types.Handler) (err error)
- func (client *RestClient) UpdateHook(hook *types.HookConfig) (err error)
- func (client *RestClient) UpdateLicense(license interface{}) error
- func (client *RestClient) UpdateMutator(mutator *types.Mutator) (err error)
- func (client *RestClient) UpdateNamespace(namespace *types.Namespace) error
- func (client *RestClient) UpdatePassword(username, pwd string) error
- func (client *RestClient) UpdateSilenced(s *types.Silenced) error
- type RoleAPIClient
- type RoleBindingAPIClient
- type SilencedAPIClient
- type UserAPIClient
Constants ¶
This section is empty.
Variables ¶
var ErrNotImplemented = errors.New("method not implemented")
ErrNotImplemented is returned by client methods that haven't been implemented in Sensu Core.
Functions ¶
func ApplyListOptions ¶
func ApplyListOptions(request *resty.Request, options *ListOptions)
ApplyListOptions mutates the given request to make it carry the semantics of the given options.
func CreateBasePath ¶
CreateBasePath ...
func UnmarshalError ¶
UnmarshalError decode the API error TODO: Export err type from routers package.
Types ¶
type APIClient ¶
type APIClient interface { AuthenticationAPIClient AssetAPIClient CheckAPIClient ClusterRoleAPIClient ClusterRoleBindingAPIClient EntityAPIClient EventAPIClient ExtensionAPIClient FilterAPIClient HandlerAPIClient HealthAPIClient HookAPIClient MutatorAPIClient NamespaceAPIClient RoleAPIClient RoleBindingAPIClient UserAPIClient SilencedAPIClient GenericClient ClusterMemberClient LicenseClient }
APIClient client methods across the Sensu API
type AssetAPIClient ¶
type AssetAPIClient interface { CreateAsset(*types.Asset) error UpdateAsset(*types.Asset) error FetchAsset(string) (*types.Asset, error) ListAssets(string, *ListOptions) ([]types.Asset, error) }
AssetAPIClient client methods for assets
type AuthenticationAPIClient ¶
type AuthenticationAPIClient interface { CreateAccessToken(url string, userid string, secret string) (*types.Tokens, error) TestCreds(userid string, secret string) error Logout(token string) error RefreshAccessToken(refreshToken string) (*types.Tokens, error) }
AuthenticationAPIClient client methods for authenticating
type CheckAPIClient ¶
type CheckAPIClient interface { CreateCheck(*types.CheckConfig) error DeleteCheck(string, string) error ExecuteCheck(*types.AdhocRequest) error FetchCheck(string) (*types.CheckConfig, error) ListChecks(string, *ListOptions) ([]types.CheckConfig, error) UpdateCheck(*types.CheckConfig) error AddCheckHook(check *types.CheckConfig, checkHook *types.HookList) error RemoveCheckHook(check *types.CheckConfig, checkHookType string, hookName string) error }
CheckAPIClient client methods for checks
type ClusterMemberClient ¶
type ClusterMemberClient interface { // MemberList lists cluster members. MemberList() (*clientv3.MemberListResponse, error) // MemberAdd adds a cluster member. MemberAdd(peerAddrs []string) (*clientv3.MemberAddResponse, error) // MemberUpdate updates a cluster member. MemberUpdate(id uint64, peerAddrs []string) (*clientv3.MemberUpdateResponse, error) // MemberRemove removes a cluster member. MemberRemove(id uint64) (*clientv3.MemberRemoveResponse, error) // FetchClusterID gets the sensu cluster id. FetchClusterID() (string, error) }
ClusterMemberClient specifies client methods for cluster membership management.
type ClusterRoleAPIClient ¶
type ClusterRoleAPIClient interface { CreateClusterRole(*types.ClusterRole) error DeleteClusterRole(string) error FetchClusterRole(string) (*types.ClusterRole, error) ListClusterRoles(*ListOptions) ([]types.ClusterRole, error) }
ClusterRoleAPIClient client methods for cluster roles
type ClusterRoleBindingAPIClient ¶
type ClusterRoleBindingAPIClient interface { CreateClusterRoleBinding(*types.ClusterRoleBinding) error DeleteClusterRoleBinding(string) error FetchClusterRoleBinding(string) (*types.ClusterRoleBinding, error) ListClusterRoleBindings(*ListOptions) ([]types.ClusterRoleBinding, error) }
ClusterRoleBindingAPIClient client methods for cluster role bindings
type EntityAPIClient ¶
type EntityAPIClient interface { CreateEntity(entity *types.Entity) error DeleteEntity(string, string) error FetchEntity(ID string) (*types.Entity, error) ListEntities(string, *ListOptions) ([]types.Entity, error) UpdateEntity(entity *types.Entity) error }
EntityAPIClient client methods for entities
type EventAPIClient ¶
type EventAPIClient interface { FetchEvent(string, string) (*types.Event, error) ListEvents(string, *ListOptions) ([]corev2.Event, error) // DeleteEvent deletes the event identified by entity, check. DeleteEvent(namespace, entity, check string) error UpdateEvent(*types.Event) error ResolveEvent(*types.Event) error }
EventAPIClient client methods for events
type ExtensionAPIClient ¶
type ExtensionAPIClient interface { ListExtensions(namespace string, options *ListOptions) ([]types.Extension, error) RegisterExtension(*types.Extension) error DeregisterExtension(name, namespace string) error }
ExtensionAPIClient client methods for extensions
type FilterAPIClient ¶
type FilterAPIClient interface { CreateFilter(*types.EventFilter) error DeleteFilter(string, string) error FetchFilter(string) (*types.EventFilter, error) ListFilters(string, *ListOptions) ([]types.EventFilter, error) UpdateFilter(*types.EventFilter) error }
FilterAPIClient client methods for filters
type GenericClient ¶
type GenericClient interface { // Delete deletes the key with the given path Delete(path string) error // Get retrieves the key at the given path and stores it into obj Get(path string, obj interface{}) error // List retrieves all keys with the given path prefix and stores them into objs List(path string, objs interface{}, options *ListOptions) error // Post creates the given obj at the specified path Post(path string, obj interface{}) error // Put creates the given obj at the specified path Put(path string, obj interface{}) error // PutResource puts a resource according to its URIPath. PutResource(types.Wrapper) error }
GenericClient exposes generic resource methods.
type HandlerAPIClient ¶
type HandlerAPIClient interface { CreateHandler(*types.Handler) error DeleteHandler(string, string) error ListHandlers(string, *ListOptions) ([]types.Handler, error) FetchHandler(string) (*types.Handler, error) UpdateHandler(*types.Handler) error }
HandlerAPIClient client methods for handlers
type HealthAPIClient ¶
type HealthAPIClient interface {
Health() (*types.HealthResponse, error)
}
HealthAPIClient client methods for health api
type HookAPIClient ¶
type HookAPIClient interface { CreateHook(*types.HookConfig) error UpdateHook(*types.HookConfig) error DeleteHook(string, string) error FetchHook(string) (*types.HookConfig, error) ListHooks(string, *ListOptions) ([]types.HookConfig, error) }
HookAPIClient client methods for hooks
type LicenseClient ¶
type LicenseClient interface { // FetchLicense fetches the installed license FetchLicense() (interface{}, error) // UpdateLicense updates the installed enterprise license UpdateLicense(license interface{}) error }
LicenseClient specifies the enteprise client methods for license management. This is a temporary workaround until https://github.com/sensu/sensu-go/issues/1870 is implemented
type ListOptions ¶
type ListOptions struct { FieldSelector string LabelSelector string // ContinueToken is the current pagination token. ContinueToken string // ChunkSize is the number of objects to fetch per page when taking // advantage of the API's pagination capabilities. ChunkSize <= 0 means // fetch everything all at once; do not use pagination. ChunkSize int }
ListOptions represents the various options that can be used when listing resources.
type MutatorAPIClient ¶
type MutatorAPIClient interface { CreateMutator(*types.Mutator) error ListMutators(string, *ListOptions) ([]types.Mutator, error) DeleteMutator(string, string) error FetchMutator(string) (*types.Mutator, error) UpdateMutator(*types.Mutator) error }
MutatorAPIClient client methods for mutators
type NamespaceAPIClient ¶
type NamespaceAPIClient interface { CreateNamespace(*types.Namespace) error UpdateNamespace(*types.Namespace) error DeleteNamespace(string) error ListNamespaces(*ListOptions) ([]types.Namespace, error) FetchNamespace(string) (*types.Namespace, error) }
NamespaceAPIClient client methods for namespaces
type RestClient ¶
type RestClient struct {
// contains filtered or unexported fields
}
RestClient wraps resty.Client
func (*RestClient) AddCheckHook ¶
func (client *RestClient) AddCheckHook(check *types.CheckConfig, checkHook *types.HookList) error
AddCheckHook associates an existing hook with an existing check
func (*RestClient) AddGroupToUser ¶
func (client *RestClient) AddGroupToUser(username, group string) error
AddGroupToUser makes "username" a member of "group".
func (*RestClient) ClearAuthToken ¶
func (client *RestClient) ClearAuthToken()
ClearAuthToken clears the authorization token from the client config
func (*RestClient) CreateAccessToken ¶
func (client *RestClient) CreateAccessToken(url, userid, password string) (*types.Tokens, error)
CreateAccessToken returns a new access token given userid and password
func (*RestClient) CreateAsset ¶
func (client *RestClient) CreateAsset(asset *types.Asset) error
CreateAsset creates an asset resource from the backend
func (*RestClient) CreateCheck ¶
func (client *RestClient) CreateCheck(check *types.CheckConfig) (err error)
CreateCheck creates new check on configured Sensu instance
func (*RestClient) CreateClusterRole ¶
func (client *RestClient) CreateClusterRole(clusterRole *types.ClusterRole) error
CreateClusterRole with the given cluster role
func (*RestClient) CreateClusterRoleBinding ¶
func (client *RestClient) CreateClusterRoleBinding(clusterRoleBinding *types.ClusterRoleBinding) error
CreateClusterRoleBinding with the given cluster role binding
func (*RestClient) CreateEntity ¶
func (client *RestClient) CreateEntity(entity *types.Entity) (err error)
CreateEntity creates a new entity
func (*RestClient) CreateFilter ¶
func (client *RestClient) CreateFilter(filter *types.EventFilter) (err error)
CreateFilter creates a new filter on configured Sensu instance
func (*RestClient) CreateHandler ¶
func (client *RestClient) CreateHandler(handler *types.Handler) (err error)
CreateHandler creates new handler on configured Sensu instance
func (*RestClient) CreateHook ¶
func (client *RestClient) CreateHook(hook *types.HookConfig) (err error)
CreateHook creates new hook on configured Sensu instance
func (*RestClient) CreateMutator ¶
func (client *RestClient) CreateMutator(mutator *types.Mutator) (err error)
CreateMutator creates new mutator on the configured Sensu instance
func (*RestClient) CreateNamespace ¶
func (client *RestClient) CreateNamespace(namespace *types.Namespace) error
CreateNamespace creates new namespace on configured Sensu instance
func (*RestClient) CreateRole ¶
func (client *RestClient) CreateRole(role *types.Role) error
CreateRole with the given role
func (*RestClient) CreateRoleBinding ¶
func (client *RestClient) CreateRoleBinding(roleBinding *types.RoleBinding) error
CreateRoleBinding with the given role binding
func (*RestClient) CreateSilenced ¶
func (client *RestClient) CreateSilenced(silenced *types.Silenced) error
CreateSilenced creates a new silenced entry.
func (*RestClient) CreateUser ¶
func (client *RestClient) CreateUser(user *types.User) error
CreateUser creates new check on configured Sensu instance
func (*RestClient) Delete ¶
func (client *RestClient) Delete(path string) error
Delete sends a DELETE request to the given path
func (*RestClient) DeleteCheck ¶
func (client *RestClient) DeleteCheck(namespace, name string) error
DeleteCheck deletes check from configured Sensu instance
func (*RestClient) DeleteClusterRole ¶
func (client *RestClient) DeleteClusterRole(name string) error
DeleteClusterRole with the given name
func (*RestClient) DeleteClusterRoleBinding ¶
func (client *RestClient) DeleteClusterRoleBinding(name string) error
DeleteClusterRoleBinding with the given name
func (*RestClient) DeleteEntity ¶
func (client *RestClient) DeleteEntity(namespace, name string) (err error)
DeleteEntity deletes given entitiy from the configured sensu instance
func (*RestClient) DeleteEvent ¶
func (client *RestClient) DeleteEvent(namespace, entity, check string) error
DeleteEvent deletes an event.
func (*RestClient) DeleteFilter ¶
func (client *RestClient) DeleteFilter(namespace, name string) error
DeleteFilter deletes a filter from configured Sensu instance
func (*RestClient) DeleteHandler ¶
func (client *RestClient) DeleteHandler(namespace, name string) (err error)
DeleteHandler deletes given handler from the configured Sensu instance
func (*RestClient) DeleteHook ¶
func (client *RestClient) DeleteHook(namespace, name string) error
DeleteHook deletes hook from configured Sensu instance
func (*RestClient) DeleteMutator ¶
func (client *RestClient) DeleteMutator(namespace, name string) (err error)
DeleteMutator deletes the given mutator from the configured Sensu instance
func (*RestClient) DeleteNamespace ¶
func (client *RestClient) DeleteNamespace(namespace string) error
DeleteNamespace deletes an namespace on configured Sensu instance
func (*RestClient) DeleteRole ¶
func (client *RestClient) DeleteRole(namespace, name string) error
DeleteRole with the given name
func (*RestClient) DeleteRoleBinding ¶
func (client *RestClient) DeleteRoleBinding(namespace, name string) error
DeleteRoleBinding with the given name
func (*RestClient) DeleteSilenced ¶
func (client *RestClient) DeleteSilenced(namespace, name string) error
DeleteSilenced deletes a silenced entry.
func (*RestClient) DeregisterExtension ¶
func (client *RestClient) DeregisterExtension(name, namespace string) error
DeregisterExtension deregisters an extension resource from the backend
func (*RestClient) DisableUser ¶
func (client *RestClient) DisableUser(username string) error
DisableUser disables a user on configured Sensu instance
func (*RestClient) ExecuteCheck ¶
func (client *RestClient) ExecuteCheck(req *types.AdhocRequest) error
ExecuteCheck sends an execution request with the provided adhoc request
func (*RestClient) FetchAsset ¶
func (client *RestClient) FetchAsset(name string) (*types.Asset, error)
FetchAsset fetches an asset resource from the backend
func (*RestClient) FetchCheck ¶
func (client *RestClient) FetchCheck(name string) (*types.CheckConfig, error)
FetchCheck fetches a specific check
func (*RestClient) FetchClusterID ¶
func (c *RestClient) FetchClusterID() (string, error)
FetchClusterID fetches the sensu cluster id.
func (*RestClient) FetchClusterRole ¶
func (client *RestClient) FetchClusterRole(name string) (*types.ClusterRole, error)
FetchClusterRole with the given name
func (*RestClient) FetchClusterRoleBinding ¶
func (client *RestClient) FetchClusterRoleBinding(name string) (*types.ClusterRoleBinding, error)
FetchClusterRoleBinding with the given name
func (*RestClient) FetchEntity ¶
func (client *RestClient) FetchEntity(name string) (*types.Entity, error)
FetchEntity fetches a specific entity
func (*RestClient) FetchEvent ¶
func (client *RestClient) FetchEvent(entity, check string) (*types.Event, error)
FetchEvent fetches a specific event
func (*RestClient) FetchFilter ¶
func (client *RestClient) FetchFilter(name string) (*types.EventFilter, error)
FetchFilter fetches a specific check
func (*RestClient) FetchHandler ¶
func (client *RestClient) FetchHandler(name string) (*types.Handler, error)
FetchHandler fetches a specific handler
func (*RestClient) FetchHook ¶
func (client *RestClient) FetchHook(name string) (*types.HookConfig, error)
FetchHook fetches a specific hook
func (*RestClient) FetchLicense ¶
func (client *RestClient) FetchLicense() (interface{}, error)
FetchLicense fetches the installed license. This is a temporary workaround until https://github.com/sensu/sensu-go/issues/1870 is implemented
func (*RestClient) FetchMutator ¶
func (client *RestClient) FetchMutator(name string) (*types.Mutator, error)
FetchMutator fetches a specific handler from the configured Sensu instance
func (*RestClient) FetchNamespace ¶
func (client *RestClient) FetchNamespace(namespaceName string) (*types.Namespace, error)
FetchNamespace fetches an namespace by name
func (*RestClient) FetchRole ¶
func (client *RestClient) FetchRole(name string) (*types.Role, error)
FetchRole with the given name
func (*RestClient) FetchRoleBinding ¶
func (client *RestClient) FetchRoleBinding(name string) (*types.RoleBinding, error)
FetchRoleBinding with the given name
func (*RestClient) FetchSilenced ¶
func (client *RestClient) FetchSilenced(name string) (*types.Silenced, error)
FetchSilenced fetches a silenced entry from configured Sensu instance
func (*RestClient) FetchUser ¶
func (client *RestClient) FetchUser(username string) (*types.User, error)
FetchUser retrieve the given user
func (*RestClient) Get ¶
func (client *RestClient) Get(path string, obj interface{}) error
Get sends a GET request for an object at the given path
func (*RestClient) Health ¶
func (c *RestClient) Health() (*types.HealthResponse, error)
func (*RestClient) List ¶
func (client *RestClient) List(path string, objs interface{}, options *ListOptions) error
List sends a GET request for all objects at the given path. The options parameter allows for enhancing the request with field/label selectors (filtering), pagination, ...
func (*RestClient) ListAssets ¶
func (client *RestClient) ListAssets(namespace string, options *ListOptions) ([]corev2.Asset, error)
ListAssets fetches a list of asset resources from the backend
func (*RestClient) ListChecks ¶
func (client *RestClient) ListChecks(namespace string, options *ListOptions) ([]corev2.CheckConfig, error)
ListChecks fetches all checks from configured Sensu instance
func (*RestClient) ListClusterRoleBindings ¶
func (client *RestClient) ListClusterRoleBindings(options *ListOptions) ([]corev2.ClusterRoleBinding, error)
ListClusterRoleBinding in the cluster
func (*RestClient) ListClusterRoles ¶
func (client *RestClient) ListClusterRoles(options *ListOptions) ([]corev2.ClusterRole, error)
ListClusterRoles within the namespace
func (*RestClient) ListEntities ¶
func (client *RestClient) ListEntities(namespace string, options *ListOptions) ([]corev2.Entity, error)
ListEntities fetches all entities from configured Sensu instance
func (*RestClient) ListEvents ¶
func (client *RestClient) ListEvents(namespace string, options *ListOptions) ([]corev2.Event, error)
ListEvents fetches events from Sensu API
func (*RestClient) ListExtensions ¶
func (client *RestClient) ListExtensions(namespace string, options *ListOptions) ([]corev2.Extension, error)
ListExtensions retrieves a list of extension resources from the backend
func (*RestClient) ListFilters ¶
func (client *RestClient) ListFilters(namespace string, options *ListOptions) ([]corev2.EventFilter, error)
ListFilters fetches all filters from configured Sensu instance
func (*RestClient) ListHandlers ¶
func (client *RestClient) ListHandlers(namespace string, options *ListOptions) ([]corev2.Handler, error)
ListHandlers fetches all handlers from configured Sensu instance
func (*RestClient) ListHooks ¶
func (client *RestClient) ListHooks(namespace string, options *ListOptions) ([]corev2.HookConfig, error)
ListHooks fetches all hooks from configured Sensu instance
func (*RestClient) ListMutators ¶
func (client *RestClient) ListMutators(namespace string, options *ListOptions) ([]corev2.Mutator, error)
ListMutators fetches all mutators from the configured Sensu instance
func (*RestClient) ListNamespaces ¶
func (client *RestClient) ListNamespaces(options *ListOptions) ([]corev2.Namespace, error)
ListNamespaces fetches all namespaces from configured Sensu instance
func (*RestClient) ListRoleBindings ¶
func (client *RestClient) ListRoleBindings(namespace string, options *ListOptions) ([]corev2.RoleBinding, error)
ListRoleBindings lists the role bindings within the given namespace.
func (*RestClient) ListRoles ¶
func (client *RestClient) ListRoles(namespace string, options *ListOptions) ([]corev2.Role, error)
ListRoles lists the roles within the given namespace.
func (*RestClient) ListSilenceds ¶
func (client *RestClient) ListSilenceds(namespace, sub, check string, options *ListOptions) ([]corev2.Silenced, error)
ListSilenceds fetches all silenced entries from configured Sensu instance
func (*RestClient) ListUsers ¶
func (client *RestClient) ListUsers(options *ListOptions) ([]corev2.User, error)
ListUsers fetches all users from configured Sensu instance
func (*RestClient) Logout ¶
func (client *RestClient) Logout(token string) error
Logout performs a logout of the configured user
func (*RestClient) MemberAdd ¶
func (c *RestClient) MemberAdd(peerAddrs []string) (*clientv3.MemberAddResponse, error)
MemberAdd adds a member to the cluster.
func (*RestClient) MemberList ¶
func (c *RestClient) MemberList() (*clientv3.MemberListResponse, error)
MemberList lists all members in the cluster.
func (*RestClient) MemberRemove ¶
func (c *RestClient) MemberRemove(id uint64) (*clientv3.MemberRemoveResponse, error)
MemberRemove removes a member from the cluster.
func (*RestClient) MemberUpdate ¶
func (c *RestClient) MemberUpdate(id uint64, peerAddrs []string) (*clientv3.MemberUpdateResponse, error)
MemberUpdate updates a member in the cluster.
func (*RestClient) Post ¶
func (client *RestClient) Post(path string, obj interface{}) error
Post sends a POST request with obj as the payload to the given path
func (*RestClient) Put ¶
func (client *RestClient) Put(path string, obj interface{}) error
Put sends a PUT request with obj as the payload to the given path
func (*RestClient) PutResource ¶
func (client *RestClient) PutResource(r types.Wrapper) error
PutResource ...
func (*RestClient) R ¶
func (client *RestClient) R() *resty.Request
R returns new resty.Request from configured client
func (*RestClient) RefreshAccessToken ¶
func (client *RestClient) RefreshAccessToken(token string) (*types.Tokens, error)
RefreshAccessToken returns a new access token given valid refresh token
func (*RestClient) RegisterExtension ¶
func (client *RestClient) RegisterExtension(extension *types.Extension) error
RegisterExtension updates an extension resource from the backend
func (*RestClient) ReinstateUser ¶
func (client *RestClient) ReinstateUser(username string) error
ReinstateUser reinstates a disabled user on configured Sensu instance
func (*RestClient) RemoveAllGroupsFromUser ¶
func (client *RestClient) RemoveAllGroupsFromUser(username string) error
RemoveGroupsFromUser removes all the groups for "username".
func (*RestClient) RemoveCheckHook ¶
func (client *RestClient) RemoveCheckHook(check *types.CheckConfig, checkHookType string, hookName string) error
RemoveCheckHook removes an association between an existing hook and an existing check
func (*RestClient) RemoveGroupFromUser ¶
func (client *RestClient) RemoveGroupFromUser(username, group string) error
RemoveGroupFromUser removes "username" from the given "group".
func (*RestClient) Reset ¶
func (client *RestClient) Reset()
Reset client so that it reconfigure on next request
func (*RestClient) ResolveEvent ¶
func (client *RestClient) ResolveEvent(event *types.Event) error
ResolveEvent resolves an event.
func (*RestClient) SetGroupsForUser ¶
func (client *RestClient) SetGroupsForUser(username string, groups []string) error
SetGroupsForUser sets the groups for "username" to "groups".
func (*RestClient) SetTLSClientConfig ¶
func (client *RestClient) SetTLSClientConfig(c *tls.Config)
SetTLSClientConfig assigns client TLS config
func (*RestClient) TestCreds ¶
func (client *RestClient) TestCreds(userid, password string) error
TestCreds checks if the provided User credentials are valid
func (*RestClient) UpdateAsset ¶
func (client *RestClient) UpdateAsset(asset *types.Asset) (err error)
UpdateAsset updates an asset resource from the backend
func (*RestClient) UpdateCheck ¶
func (client *RestClient) UpdateCheck(check *types.CheckConfig) (err error)
UpdateCheck updates given check on configured Sensu instance
func (*RestClient) UpdateEntity ¶
func (client *RestClient) UpdateEntity(entity *types.Entity) (err error)
UpdateEntity updates given entity on configured Sensu instance
func (*RestClient) UpdateEvent ¶
func (client *RestClient) UpdateEvent(event *types.Event) error
UpdateEvent updates an event.
func (*RestClient) UpdateFilter ¶
func (client *RestClient) UpdateFilter(f *types.EventFilter) error
UpdateFilter updates an existing filter with fields from a new one.
func (*RestClient) UpdateHandler ¶
func (client *RestClient) UpdateHandler(handler *types.Handler) (err error)
UpdateHandler updates given handler on configured Sensu instance
func (*RestClient) UpdateHook ¶
func (client *RestClient) UpdateHook(hook *types.HookConfig) (err error)
UpdateHook updates given hook on configured Sensu instance
func (*RestClient) UpdateLicense ¶
func (client *RestClient) UpdateLicense(license interface{}) error
UpdateLicense updates the installed license with the given one. This is a temporary workaround until https://github.com/sensu/sensu-go/issues/1870 is implemented
func (*RestClient) UpdateMutator ¶
func (client *RestClient) UpdateMutator(mutator *types.Mutator) (err error)
UpdateMutator updates a given mutator on a configured Sensu instance
func (*RestClient) UpdateNamespace ¶
func (client *RestClient) UpdateNamespace(namespace *types.Namespace) error
UpdateNamespace updates given namespace on a configured Sensu instance
func (*RestClient) UpdatePassword ¶
func (client *RestClient) UpdatePassword(username, pwd string) error
UpdatePassword updates password of given user on configured Sensu instance
func (*RestClient) UpdateSilenced ¶
func (client *RestClient) UpdateSilenced(s *types.Silenced) error
UpdateSilenced updates a silenced entry from configured Sensu instance
type RoleAPIClient ¶
type RoleAPIClient interface { CreateRole(*types.Role) error DeleteRole(string, string) error FetchRole(string) (*types.Role, error) ListRoles(string, *ListOptions) ([]types.Role, error) }
RoleAPIClient client methods for roles
type RoleBindingAPIClient ¶
type RoleBindingAPIClient interface { CreateRoleBinding(*types.RoleBinding) error DeleteRoleBinding(string, string) error FetchRoleBinding(string) (*types.RoleBinding, error) ListRoleBindings(string, *ListOptions) ([]types.RoleBinding, error) }
RoleBindingAPIClient client methods for role bindings
type SilencedAPIClient ¶
type SilencedAPIClient interface { // CreateSilenced creates a new silenced entry from its input. CreateSilenced(*types.Silenced) error // DeleteSilenced deletes an existing silenced entry given its ID. DeleteSilenced(namespace string, name string) error // ListSilenceds lists all silenced entries, optionally constraining by // subscription or check. ListSilenceds(namespace, subscription, check string, options *ListOptions) ([]types.Silenced, error) // FetchSilenced fetches the silenced entry by ID. FetchSilenced(id string) (*types.Silenced, error) // UpdateSilenced updates an existing silenced entry. UpdateSilenced(*types.Silenced) error }
SilencedAPIClient client methods for silenced
type UserAPIClient ¶
type UserAPIClient interface { AddGroupToUser(string, string) error CreateUser(*types.User) error DisableUser(string) error FetchUser(string) (*types.User, error) ListUsers(*ListOptions) ([]types.User, error) ReinstateUser(string) error RemoveGroupFromUser(string, string) error RemoveAllGroupsFromUser(string) error SetGroupsForUser(string, []string) error UpdatePassword(string, string) error }
UserAPIClient client methods for users