Documentation ¶
Index ¶
- func Marshal(e Entity) (*entityv1alpha1.Entity, []*entityv1alpha1.ChildRelation, error)
- func Unmarshal(e *entityv1alpha1.Entity, out Entity) error
- type AttrCache
- type BatchGetInput
- type BatchGetOutput
- type BatchPutJSONInput
- type BatchUpdateInput
- type BatchUpdateOutput
- type ChildRelation
- type Client
- func (c *Client) All(ctx context.Context, input ListInput) (out []*entityv1alpha1.Entity, err error)
- func (c *Client) AttrCache() *AttrCache
- func (c *Client) BatchGet(ctx context.Context, input BatchGetInput) (*BatchGetOutput, error)
- func (c *Client) BatchPutJSON(ctx context.Context, input BatchPutJSONInput) (*BatchUpdateOutput, error)
- func (c *Client) BatchUpdate(ctx context.Context, input BatchUpdateInput) (*BatchUpdateOutput, error)
- func (c *Client) GetEntity(ctx context.Context, input GetInput) (*entityv1alpha1.GetResponse, error)
- func (c *Client) GetNamed(ctx context.Context, eid eid.EID) *accessv1alpha1.NamedEID
- func (c *Client) GetUser(ctx context.Context, eid eid.EID) *accessv1alpha1.User
- func (c *Client) List(ctx context.Context, input ListInput) (*ListOutput, error)
- func (c *Client) ListChildren(ctx context.Context, input ListChildrenInput) (ListChildrenOutput, error)
- func (c *Client) ListChildrenRequest(input ListChildrenInput) *listChildrenRequestCall
- func (c *Client) ListParents(ctx context.Context, input ListParentsInput) (ListParentsOutput, error)
- func (c *Client) ListParentsRequest(input ListParentsInput) *listParentsRequestCall
- func (c *Client) ListRequest(input ListInput) *listEntitiesRequestCall
- func (c *Client) Put(ctx context.Context, input PutInput) (*BatchUpdateOutput, error)
- func (c *Client) RawClient() entityv1alpha1connect.EntityServiceClient
- type Entity
- type EntityJSON
- type GetInput
- type ListChildrenInput
- type ListChildrenOutput
- type ListInput
- type ListOutput
- type ListParentsInput
- type ListParentsOutput
- type Opts
- type Parenter
- type PutInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶
func Marshal(e Entity) (*entityv1alpha1.Entity, []*entityv1alpha1.ChildRelation, error)
Types ¶
type AttrCache ¶
type AttrCache struct {
// contains filtered or unexported fields
}
func (*AttrCache) String ¶
String obtains a cached string attribute for an entity. Attributes like names do not change that often, so they are cached in memory. If the attribute does not exist for an entity or there is an error, an empty string is returned
An error is logged if there was an issue reaching the Authz service.
type BatchGetInput ¶
type BatchGetOutput ¶
type BatchGetOutput = entityv1alpha1.BatchGetResponse
type BatchPutJSONInput ¶
type BatchPutJSONInput struct {
Entities []EntityJSON
}
type BatchUpdateInput ¶
type BatchUpdateInput struct { // Put is a slice of entities to be upserted to the entity store. Put []Entity // PutChildren is a slice of parent/child relationships to be added to the entity store. PutChildren []ChildRelation // Archive is a slice of EIDs of entities to be archived. // When an entity is archived it will no longer appear in the List API calls by default. Archive []eid.EID // Unarchive is a slice of EIDs of entities to be made active again. Unarchive []eid.EID // Unarchive is a slice of EIDs of entities to be deleted from the entity store. Delete []eid.EID // DeleteChildren is a slice of parent/child relations to be removed from the entity store. DeleteChildren []ChildRelation }
type BatchUpdateOutput ¶
type BatchUpdateOutput = entityv1alpha1.BatchUpdateResponse
type ChildRelation ¶
func (ChildRelation) ToAPI ¶
func (cr ChildRelation) ToAPI() *entityv1alpha1.ChildRelation
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewFromConfig ¶
func (*Client) All ¶ added in v1.12.2
func (c *Client) All(ctx context.Context, input ListInput) (out []*entityv1alpha1.Entity, err error)
All returns all results from a paginated API
func (*Client) AttrCache ¶
AttrCache returns a cach for looking up entity attributes. This cache should ONLY be used for attributes not related to authorization decisions, such as displaying names, email addresses and labels.
func (*Client) BatchGet ¶
func (c *Client) BatchGet(ctx context.Context, input BatchGetInput) (*BatchGetOutput, error)
func (*Client) BatchPutJSON ¶
func (c *Client) BatchPutJSON(ctx context.Context, input BatchPutJSONInput) (*BatchUpdateOutput, error)
func (*Client) BatchUpdate ¶
func (c *Client) BatchUpdate(ctx context.Context, input BatchUpdateInput) (*BatchUpdateOutput, error)
func (*Client) GetEntity ¶
func (c *Client) GetEntity(ctx context.Context, input GetInput) (*entityv1alpha1.GetResponse, error)
func (*Client) GetNamed ¶
GetNamed hydrates a resource with the 'name' attribute from the cache. This may result in additional API calls to the authz service if the entity is not present in the client cache.
func (*Client) GetUser ¶
GetUser hydrates a resource with the 'name' and 'email' attribute from the cache. This may result in additional API calls to the authz service if the entity is not present in the client cache.
func (*Client) ListChildren ¶
func (c *Client) ListChildren(ctx context.Context, input ListChildrenInput) (ListChildrenOutput, error)
func (*Client) ListChildrenRequest ¶
func (c *Client) ListChildrenRequest(input ListChildrenInput) *listChildrenRequestCall
func (*Client) ListParents ¶
func (c *Client) ListParents(ctx context.Context, input ListParentsInput) (ListParentsOutput, error)
func (*Client) ListParentsRequest ¶
func (c *Client) ListParentsRequest(input ListParentsInput) *listParentsRequestCall
func (*Client) ListRequest ¶
FilterEntitiesRequest returns a request with filterEntitiesRequestCall.Pages() that will pull all pages of results, invoking the callback for each page I based this pattern off the google cloud SDK, I found it to be pretty neat, not set on the naming I think a good API here will have the option to do a single API call or a Pages call in the google API it would be filterEntitiesRequestCall.Do() to make a single request they also use a chained builder pattern
func (*Client) RawClient ¶
func (c *Client) RawClient() entityv1alpha1connect.EntityServiceClient
RawClient returns the underlying Buf Connect client.
type EntityJSON ¶
type EntityJSON struct { EID eid.EID `json:"eid"` Attrs map[string]any `json:"attrs"` Parents []eid.EID `json:"parents"` }
EntityJSON is a JSON representation of entities. It matches the Cedar Rust SDK JSON format.
type ListChildrenInput ¶
type ListChildrenOutput ¶
type ListOutput ¶
type ListOutput = entityv1alpha1.ListResponse
type ListParentsInput ¶
type ListParentsOutput ¶
type Opts ¶
type Opts struct { HTTPClient connect.HTTPClient BaseURL string ClientOptions []connect.ClientOption // AttrCacheExpiration defaults to 24h if not provided AttrCacheExpiration time.Duration // AttrCleanupInterval defaults to 48h if not provided AttrCleanupInterval time.Duration }