sdk

package
v0.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2022 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAppTrait added in v0.0.12

func GetAppTrait(resource *v2.Resource) (*v2.AppTrait, error)

GetAppTrait attempts to return the AppTrait instance on a resource.

func GetGroupTrait added in v0.0.12

func GetGroupTrait(resource *v2.Resource) (*v2.GroupTrait, error)

GetGroupTrait attempts to return the GroupTrait instance on a resource.

func GetProfileInt64Value added in v0.0.12

func GetProfileInt64Value(profile *structpb.Struct, k string) (int64, bool)

GetProfileInt64Value returns an int64 and true if the value is found.

func GetProfileStringValue added in v0.0.12

func GetProfileStringValue(profile *structpb.Struct, k string) (string, bool)

GetProfileStringValue returns a string and true if the value is found.

func GetRoleTrait added in v0.0.12

func GetRoleTrait(resource *v2.Resource) (*v2.RoleTrait, error)

GetRoleTrait attempts to return the RoleTrait instance on a resource.

func GetUserTrait added in v0.0.12

func GetUserTrait(resource *v2.Resource) (*v2.UserTrait, error)

GetUserTrait attempts to return the UserTrait instance on a resource.

func NewAppResource added in v0.0.11

func NewAppResource(
	name string,
	resourceType *v2.ResourceType,
	parentResourceID *v2.ResourceId,
	objectID interface{},
	helpURL string,
	profile map[string]interface{},
) (*v2.Resource, error)

NewAppResource returns a new resource instance with a configured app trait. The trait is configured with the provided helpURL and profile.

func NewAppTrait

func NewAppTrait(helpURL string, profile map[string]interface{}) (*v2.AppTrait, error)

NewAppTrait creates a new `AppTrait` with the given help URL, and profile.

func NewAssignmentEntitlement added in v0.0.11

func NewAssignmentEntitlement(resource *v2.Resource, name string, grantableTo ...*v2.ResourceType) *v2.Entitlement

func NewConnectorRunner

func NewConnectorRunner(ctx context.Context, c types.ConnectorServer, dbPath string, opts ...Option) (*connectorRunner, error)

NewConnectorRunner creates a new connector runner.

func NewEmptyConnector

func NewEmptyConnector() (*emptyConnector, error)

NewEmptyConnector returns a new emptyConnector.

func NewEntitlementID added in v0.0.7

func NewEntitlementID(resource *v2.Resource, permission string) string

func NewGrant added in v0.0.11

func NewGrant(resource *v2.Resource, entitlementName string, principal *v2.ResourceId) *v2.Grant

NewGrant returns a new grant for the given entitlement on the resource for the provided principal resource ID.

func NewGroupResource added in v0.0.11

func NewGroupResource(
	name string,
	resourceType *v2.ResourceType,
	parentResourceID *v2.ResourceId,
	objectID interface{},
	profile map[string]interface{},
) (*v2.Resource, error)

NewGroupResource returns a new resource instance with a configured group trait. The trait is configured with the provided profile.

func NewGroupTrait

func NewGroupTrait(profile map[string]interface{}) (*v2.GroupTrait, error)

NewGroupTrait creates a new `GroupTrait` with the provided profile.

func NewPermissionEntitlement added in v0.0.11

func NewPermissionEntitlement(resource *v2.Resource, name string, grantableTo ...*v2.ResourceType) *v2.Entitlement

func NewResource added in v0.0.11

func NewResource(name string, resourceType *v2.ResourceType, parentResourceID *v2.ResourceId, objectID interface{}) (*v2.Resource, error)

NewResource returns a new resource instance with no traits.

func NewResourceID added in v0.0.7

func NewResourceID(resourceType *v2.ResourceType, objectID interface{}) (*v2.ResourceId, error)

NewResourceID returns a new resource ID given a resource type parent ID, and arbitrary object ID.

func NewRoleResource added in v0.0.11

func NewRoleResource(
	name string,
	resourceType *v2.ResourceType,
	parentResourceID *v2.ResourceId,
	objectID interface{},
	profile map[string]interface{},
) (*v2.Resource, error)

NewRoleResource returns a new resource instance with a configured role trait. The trait is configured with the provided profile.

func NewRoleTrait added in v0.0.8

func NewRoleTrait(profile map[string]interface{}) (*v2.RoleTrait, error)

NewRoleTrait creates a new `RoleTrait` with the given profile.

func NewUserResource added in v0.0.11

func NewUserResource(
	name string,
	resourceType *v2.ResourceType,
	parentResourceID *v2.ResourceId,
	objectID interface{},
	primaryEmail string,
	profile map[string]interface{},
) (*v2.Resource, error)

NewUserResource returns a new resource instance with a configured user trait. The trait is configured with the provided email address and profile and status set to enabled.

func NewUserTrait

func NewUserTrait(primaryEmail string, status v2.UserTrait_Status_Status, profile map[string]interface{}) (*v2.UserTrait, error)

NewUserTrait creates a new `UserTrait` with the given primary email, status, and profile.

Types

type Option

type Option func(ctx context.Context, cfg *runnerConfig) error

func WithExternalLimiter

func WithExternalLimiter(address string, opts map[string]string) Option

WithExternalLimiter configures the connector to use an external rate limiter. The `opts` map is injected into the environment in order for the service to be configured.

func WithFixedMemoryLimiter

func WithFixedMemoryLimiter(rate int64, period time.Duration) Option

WithFixedMemoryLimiter configures to use a fixed-memory limiter. `rate` is a number on how many times it should be in the given period executed. `period` represents the elapsed time between two instants as an int64 nanosecond count.

func WithRateLimitDescriptor

func WithRateLimitDescriptor(entry *ratelimitV1.RateLimitDescriptors_Entry) Option

WithRateLimitDescriptor takes a rate limit descriptor and adds it to the list of rate limit descriptors.

func WithRateLimiterConfig

func WithRateLimiterConfig(cfg *ratelimitV1.RateLimiterConfig) Option

WithRateLimiterConfig sets the RateLimiterConfig for a runner.

func WithSlidingMemoryLimiter

func WithSlidingMemoryLimiter(usePercent int64) Option

WithSlidingMemoryLimiter configures the connector to use an in-memory rate limiter that adjusts to maintain fairness based on request headers. `usePercent` is value between 0 and 100.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL