Documentation ¶
Index ¶
- Constants
- Variables
- type APIClient
- func (c *APIClient) DeletePolicy(ctx context.Context, id string) error
- func (c *APIClient) GetPermissionsBundle(ctx context.Context) (Bundle, error)
- func (c *APIClient) GetPolicy(ctx context.Context, id string) (*models.Policy, error)
- func (c *APIClient) GetRole(ctx context.Context, id string) (*models.Roles, error)
- func (c *APIClient) GetRoles(ctx context.Context) (*models.Roles, error)
- func (c *APIClient) PostPolicy(ctx context.Context, policy models.PolicyInfo) (*models.Policy, error)
- func (c *APIClient) PutPolicy(ctx context.Context, id string, policy models.Policy) error
- type Bundle
- type Condition
- type EntityData
- type EntityIDToPolicies
- type HTTPClient
- type Operator
- type Options
- type Policy
Constants ¶
const (
Authorization string = "Authorization"
)
package level constants
Variables ¶
var ( // ErrGetPermissionsResponseBodyNil error used when a nil response is returned from the permissions API. ErrGetPermissionsResponseBodyNil = errors.New("error creating get permissions request http.Request required but was nil") // ErrFailedToParsePermissionsResponse error used when an unexpected response body is returned from the permissions API and it fails to parse. ErrFailedToParsePermissionsResponse = errors.New("error parsing permissions bundle response body") // ErrNotCached error error used when permissions are not found in the cache. ErrNotCached = errors.New("permissions bundle not found in the cache") )
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
APIClient implementation of permissions.Store that gets permission data from the permissions API
func NewClient ¶
NewClient constructs a new APIClient instance with a default http client and Options.
func NewClientWithClienter ¶
func NewClientWithClienter(host string, httpClient HTTPClient, opts Options) *APIClient
NewClientWithClienter constructs a new APIClient instance.
func NewClientWithOptions ¶
NewClientWithOptions returns a new APIClient with default http
func (*APIClient) DeletePolicy ¶ added in v0.20.0
func (*APIClient) GetPermissionsBundle ¶
GetPermissionsBundle gets the permissions bundle data from the permissions API.
func (*APIClient) PostPolicy ¶ added in v0.20.0
type Bundle ¶
type Bundle map[string]EntityIDToPolicies
Bundle is the optimised lookup table for permissions.
type Condition ¶
type Condition struct { Attribute string `json:"attribute"` Operator Operator `json:"operator"` Values []string `json:"values"` }
Condition is used within a policy to match additional attributes.
type EntityData ¶
EntityData groups the different entity types into a single parameter
type EntityIDToPolicies ¶
EntityIDToPolicies maps an entity ID to a slice of policies.
type HTTPClient ¶
HTTPClient is the interface that defines a client for making HTTP requests
type Operator ¶
type Operator string
Operator is used to define a set of supported Condition operators