Documentation ¶
Overview ¶
Package sentryapi provides GO-specific client interface to Apache Sentry. It supports both Generic and legacy APIs. The interface is defined by SentryClientAPI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientAPI ¶
type ClientAPI interface { // Close closes the client connection Close() // CreateRole creates a role with given name // roleName - role name CreateRole(roleName string) error // RemoveRole removes role with given name // roleName - role name RemoveRole(roleName string) error // ListRoleByGroup returns list of role names for a given group or all // roles if group is nil // groupName - group name ListRoleByGroup(groupName string) ([]string, []*Role, error) // AddGroupsToRole adds specified groups to the role // roleName - role name // groups - list of group names to add AddGroupsToRole(roleName string, groups []string) error // RemoveGroupsFromRole removes specified groups from the role // roleName - role name // groups - list of group names to remove RemoveGroupsFromRole(roleName string, groups []string) error // GrantPrivilege grants privilege to the role // roleName - role name // priv - privilege to grant GrantPrivilege(roleName string, priv *Privilege) error // RevokePrivilege revokes privilege from the role // roleName - role name // priv - privilege to revoke RevokePrivilege(roleName string, priv *Privilege) error // ListPrivilegesByRole returns a list of privileges for the role // role. // If template is not NULL, only return privileges matching template ListPrivilegesByRole(roleName string, template *Privilege) ([]*Privilege, error) }
ClientAPI is a generic Apache Sentry client interface. The API is the same for the Generic or Hive model.
func GetClient ¶
func GetClient(protocol ProtocolType, host string, port int, component string, user string) (ClientAPI, error)
GetClient returns a Sentry client implementation
protocol - legacy or generic host - server host port - server port component - Sentry component for generic protocol user - Sentry authorization user
type Privilege ¶
type Privilege struct { Scope string Server string Database string Table string Column string URI string Action string Service string GrantOption bool UnsetGrantOption bool // True is grant option is unset }
Privilege is the Sentry privilege representation. It comboines Generic model and legacy Hive model
type ProtocolType ¶
type ProtocolType int
ProtocolType is enum describing available Apache Sentry protocols. Currently Sentry supports two protocols: old protocol and generic protocol.
const ( PolicyProtocol ProtocolType = iota GenericPolicyProtocol )
PolicyProtocol is the legacy Sentry protocol GenericPolicyProtocol is the generic Sentry protocol
func (ProtocolType) String ¶
func (pt ProtocolType) String() string