Documentation ¶
Index ¶
- Constants
- Variables
- func AccessMatch(access1, access2 AccessType) bool
- func ResourceMatch(resource1, resource2 ResourceType) bool
- type Access
- type AccessList
- type AccessType
- type Application
- type Client
- func (c *Client) GetAccessList(application Application) (AccessList, error)
- func (c *Client) GetInventoryGroupsAccess(acl AccessList, resource ResourceType, accessType AccessType) (bool, []string, bool, error)
- func (c *Client) GetRBacAccessHTTPRequest(ctx context.Context, application Application) (*http.Request, error)
- type ClientInterface
- type PaginationLinks
- type PaginationMeta
- type ResourceDefinition
- type ResourceDefinitionFilter
- type ResourceType
- type ResponseBody
Constants ¶
const APIPath = "/api/rbac/v1"
APIPath the rbac base path
const DefaultTimeDuration = 1 * time.Second
const PaginationLimit = "1000"
PaginationLimit to get a maximum of 1000 records
Variables ¶
var ErrCreatingRbacURL = errors.New("error occurred when creating rbac url")
var ErrFailedToBuildAccessRequest = errors.New("failed to build access request")
var ErrInvalidAttributeFilterKey = errors.New("invalid value for attributeFilter.key in RBAC response")
var ErrInvalidAttributeFilterOperation = errors.New("invalid value for attributeFilter.operation in RBAC response")
var ErrInvalidAttributeFilterValue = errors.New("received invalid UUIDs for attributeFilter.value in RBAC response")
var ErrRbacRequestResponse = errors.New("rbac response error")
var HTTPGetCommand = http.MethodGet
HTTPGetCommand the http get command
var IOReadAll = io.ReadAll
IOReadAll The io body reader
Functions ¶
func AccessMatch ¶
func AccessMatch(access1, access2 AccessType) bool
AccessMatch return whether the access type matches the required resource type
func ResourceMatch ¶
func ResourceMatch(resource1, resource2 ResourceType) bool
ResourceMatch return whether the resource type matches the required resource type
Types ¶
type Access ¶
type Access struct { ResourceDefinitions []ResourceDefinition `json:"resourceDefinitions,omitempty"` Permission string `json:"permission"` }
Access represents a permission and an optional resource definition
func (Access) AccessType ¶
AccessType returns the access type in the permission
func (Access) Application ¶
Application returns the name of the application in the permission
type AccessList ¶
type AccessList []Access
AccessList is a slice of Accesses and is generally used to represent a principal's full set of permissions for an application
type AccessType ¶
type AccessType string
const ( AccessTypeAny AccessType = "*" AccessTypeRead AccessType = "read" )
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the implementation of an ClientInterface
func (*Client) GetAccessList ¶
func (c *Client) GetAccessList(application Application) (AccessList, error)
GetAccessList return the application rbac access list
func (*Client) GetInventoryGroupsAccess ¶
func (c *Client) GetInventoryGroupsAccess(acl AccessList, resource ResourceType, accessType AccessType) (bool, []string, bool, error)
GetInventoryGroupsAccess return whether access is allowed and the groups configurations
func (*Client) GetRBacAccessHTTPRequest ¶
type ClientInterface ¶
type ClientInterface interface { GetAccessList(application Application) (AccessList, error) GetInventoryGroupsAccess(acl AccessList, resource ResourceType, accessType AccessType) (bool, []string, bool, error) }
ClientInterface is an Interface to make request to insights rbac
func InitClient ¶
func InitClient(ctx context.Context, log log.FieldLogger) ClientInterface
InitClient initializes the client for Rbac service
type PaginationLinks ¶
type PaginationLinks struct { First string `json:"first"` Next string `json:"next"` Previous string `json:"previous"` Last string `json:"last"` }
PaginationLinks provides links to additional pages of response data
type PaginationMeta ¶
type PaginationMeta struct { Count int `json:"count"` Limit int `json:"limit"` Offset int `json:"offset"` }
PaginationMeta contains metadata for pagination
type ResourceDefinition ¶
type ResourceDefinition struct {
Filter ResourceDefinitionFilter `json:"attributeFilter"`
}
ResourceDefinition limits an Access to specific resources
type ResourceDefinitionFilter ¶
type ResourceDefinitionFilter struct { Key string `json:"key"` Operation string `json:"operation"` Value []*string `json:"value"` }
ResourceDefinitionFilter represents the key/values used for filtering
type ResourceType ¶
type ResourceType string
const ( ResourceTypeAny ResourceType = "*" ResourceTypeHOSTS ResourceType = "hosts" )
type ResponseBody ¶
type ResponseBody struct { Meta PaginationMeta `json:"meta"` Links PaginationLinks `json:"links"` Data AccessList `json:"data"` }
ResponseBody represents the response body format from the RBAC service