Documentation
¶
Overview ¶
Oso Client cloud for Golang. For more detailed documentation, see https://www.osohq.com/docs/reference/client-apis/go
Index ¶
- type AuthorizeResult
- type Fact
- type Instance
- type OsoClient
- func NewClient(url string, apiKey string) OsoClient
- func NewClientWithDataBindings(url string, apiKey string, dataBindings string) OsoClient
- func NewClientWithFallbackUrl(url string, apiKey string, fallbackUrl string) OsoClient
- func NewClientWithFallbackUrlAndDataBindings(url string, apiKey string, fallbackUrl string, dataBindings string) OsoClient
- func NewClientWithFallbackUrlAndLogger(url string, apiKey string, fallbackUrl string, logger interface{}) OsoClient
- func NewClientWithFallbackUrlAndLoggerAndDataBindings(url string, apiKey string, fallbackUrl string, logger interface{}, ...) OsoClient
- func NewClientWithLogger(url string, apiKey string, logger interface{}) OsoClient
- func NewClientWithLoggerAndDataBindings(url string, apiKey string, logger interface{}, dataBindings string) OsoClient
- type PolicyMetadata
- type ResourceMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthorizeResult ¶ added in v0.6.0
type AuthorizeResult authorizeResult
type OsoClient ¶ added in v1.0.0
type OsoClient interface { // List authorized actions: // Fetches a list of actions which an actor can perform on a particular resource. Actions(actor Instance, resource Instance) ([]string, error) // List authorized actions for a list of resources // Fetches a list of actions which an actor can perform on a list of resources. // // Note: this only works for resources of the same type. BulkActions(actor Instance, resources []Instance, context_facts []Fact) ([][]string, error) // List authorized actions: // Fetches a list of actions which an actor can perform on a particular resource, considering the given context facts. ActionsWithContext(actor Instance, resource Instance, context_facts []Fact) ([]string, error) // Check a permission: // Determines whether or not an action is allowed, based on a combination of authorization data and policy logic. Authorize(actor Instance, action string, resource Instance) (bool, error) // Check authorized resources: // Returns a subset of resources on which an actor can perform a particular action. // Ordering and duplicates, if any exist, are preserved. AuthorizeResources(actor Instance, action string, resources []Instance) ([]Instance, error) // Check authorized resources: // Returns a subset of resources on which an actor can perform a particular action, considering the given context facts. // Ordering and duplicates, if any exist, are preserved. AuthorizeResourcesWithContext(actor Instance, action string, resources []Instance, context_facts []Fact) ([]Instance, error) // Check a permission: // Determines whether or not an action is allowed, based on a combination of authorization data (including the given context facts) and policy logic. AuthorizeWithContext(actor Instance, action string, resource Instance, context_facts []Fact) (bool, error) // Transactionally delete and add facts: // Deletes and adds many facts in one atomic transaction. The deletions are performed before the adds. // Does not throw an error when the facts to delete are not found. Bulk(delete []Fact, tell []Fact) error // Delete many facts: // Deletes many facts at once. Does not throw an error when some of the facts are not found. BulkDelete(facts []Fact) error // Add many facts: // Adds many facts at once. BulkTell(facts []Fact) error // Delete fact: // Deletes a fact. Does not throw an error if the fact is not found. Delete(predicate string, args ...Instance) error // List facts: // Lists facts that are stored in Oso Cloud. Can be used to check the existence of a particular fact, or used to fetch all facts that have a particular argument. Get(predicate string, args ...Instance) ([]Fact, error) // List authorized resources: // Fetches a list of resource ids on which an actor can perform a particular action. List(actor Instance, action string, resource string, context_facts []Fact) ([]string, error) // List authorized resources: // Fetches a list of resource ids on which an actor can perform a particular action, considering the given context facts. ListWithContext(actor Instance, action string, resource string, context_facts []Fact) ([]string, error) // Update the active policy: // Updates the policy in Oso Cloud. The string passed into this method should be written in Polar. Policy(policy string) error // Returns metadata about the currently active policy GetPolicyMetadata() (*PolicyMetadata, error) // Query Oso Cloud: // Query Oso Cloud for any predicate, and any combination of concrete and // wildcard arguments. Query(predicate string, args ...*Instance) ([]Fact, error) // Add fact: // Adds a fact named predicate with the provided arguments. Tell(predicate string, args ...Instance) error // Check a permission depending on data both in Oso Cloud and stored in a local database: // Returns a SQL query to run against the local database. AuthorizeLocal(actor Instance, action string, resource Instance) (string, error) // List authorized resources depending on data both in Oso Cloud and stored in a local database: // Returns a SQL query to run against the local database. ListLocal(actor Instance, action string, resource string, column string) (string, error) // Fetches a query that can be run against your database to determine the actions // an actor can perform on a resource. // Returns a SQL query to run against the local database. ActionsLocal(actor Instance, resource Instance) (string, error) }
func NewClientWithDataBindings ¶ added in v1.6.0
func NewClientWithFallbackUrl ¶ added in v1.2.0
Create a new Oso client with a fallback URL configured
func NewClientWithFallbackUrlAndDataBindings ¶ added in v1.6.0
func NewClientWithFallbackUrlAndLogger ¶ added in v1.2.0
func NewClientWithFallbackUrlAndLoggerAndDataBindings ¶ added in v1.6.0
func NewClientWithFallbackUrlAndLoggerAndDataBindings(url string, apiKey string, fallbackUrl string, logger interface{}, dataBindings string) OsoClient
Create a new Oso client with a fallbackURL and custom logger
See https://pkg.go.dev/github.com/hashicorp/go-retryablehttp@v0.7.1#LeveledLogger for documentation on the logger interfaces supported.
func NewClientWithLogger ¶ added in v1.0.2
Create a new Oso client with a custom logger
See https://pkg.go.dev/github.com/hashicorp/go-retryablehttp@v0.7.1#LeveledLogger for documentation on the logger interfaces supported.
type PolicyMetadata ¶ added in v1.4.0
type PolicyMetadata struct {
Resources map[string]ResourceMetadata `json:"resources"`
}
Click to show internal directories.
Click to hide internal directories.