Documentation ¶
Index ¶
- func GetAppTrait(resource *v2.Resource) (*v2.AppTrait, error)
- func GetGroupTrait(resource *v2.Resource) (*v2.GroupTrait, error)
- func GetProfileInt64Value(profile *structpb.Struct, k string) (int64, bool)
- func GetProfileStringValue(profile *structpb.Struct, k string) (string, bool)
- func GetRoleTrait(resource *v2.Resource) (*v2.RoleTrait, error)
- func GetUserTrait(resource *v2.Resource) (*v2.UserTrait, error)
- func NewAppResource(name string, resourceType *v2.ResourceType, objectID interface{}, ...) (*v2.Resource, error)
- func NewAppTrait(opts ...AppTraitOption) (*v2.AppTrait, error)
- func NewGroupResource(name string, resourceType *v2.ResourceType, objectID interface{}, ...) (*v2.Resource, error)
- func NewGroupTrait(opts ...GroupTraitOption) (*v2.GroupTrait, error)
- func NewResource(name string, resourceType *v2.ResourceType, objectID interface{}, ...) (*v2.Resource, error)
- func NewResourceID(resourceType *v2.ResourceType, objectID interface{}) (*v2.ResourceId, error)
- func NewResourceType(name string, requiredTraits []v2.ResourceType_Trait, msgs ...proto.Message) *v2.ResourceType
- func NewRoleResource(name string, resourceType *v2.ResourceType, objectID interface{}, ...) (*v2.Resource, error)
- func NewRoleTrait(opts ...RoleTraitOption) (*v2.RoleTrait, error)
- func NewUserResource(name string, resourceType *v2.ResourceType, objectID interface{}, ...) (*v2.Resource, error)
- func NewUserTrait(opts ...UserTraitOption) (*v2.UserTrait, error)
- type AppTraitOption
- type GroupTraitOption
- type ResourceOption
- func WithAnnotation(msgs ...proto.Message) ResourceOption
- func WithAppTrait(opts ...AppTraitOption) ResourceOption
- func WithDescription(description string) ResourceOption
- func WithGroupTrait(opts ...GroupTraitOption) ResourceOption
- func WithParentResourceID(parentResourceID *v2.ResourceId) ResourceOption
- func WithRoleTrait(opts ...RoleTraitOption) ResourceOption
- func WithUserTrait(opts ...UserTraitOption) ResourceOption
- type RoleTraitOption
- type UserTraitOption
- func WithAccountType(accountType v2.UserTrait_AccountType) UserTraitOption
- func WithEmail(email string, primary bool) UserTraitOption
- func WithStatus(status v2.UserTrait_Status_Status) UserTraitOption
- func WithUserIcon(assetRef *v2.AssetRef) UserTraitOption
- func WithUserLogin(login string, aliases ...string) UserTraitOption
- func WithUserProfile(profile map[string]interface{}) UserTraitOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAppTrait ¶
GetAppTrait attempts to return the AppTrait instance on a resource.
func GetGroupTrait ¶
func GetGroupTrait(resource *v2.Resource) (*v2.GroupTrait, error)
GetGroupTrait attempts to return the GroupTrait instance on a resource.
func GetProfileInt64Value ¶
GetProfileInt64Value returns an int64 and true if the value is found.
func GetProfileStringValue ¶
GetProfileStringValue returns a string and true if the value is found.
func GetRoleTrait ¶
GetRoleTrait attempts to return the RoleTrait instance on a resource.
func GetUserTrait ¶
GetUserTrait attempts to return the UserTrait instance on a resource.
func NewAppResource ¶
func NewAppResource( name string, resourceType *v2.ResourceType, objectID interface{}, appTraitOpts []AppTraitOption, opts ...ResourceOption, ) (*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(opts ...AppTraitOption) (*v2.AppTrait, error)
NewAppTrait creates a new `AppTrait` with the given help URL, and profile.
func NewGroupResource ¶
func NewGroupResource( name string, resourceType *v2.ResourceType, objectID interface{}, groupTraitOpts []GroupTraitOption, opts ...ResourceOption, ) (*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(opts ...GroupTraitOption) (*v2.GroupTrait, error)
NewGroupTrait creates a new `GroupTrait` with the provided profile.
func NewResource ¶
func NewResource(name string, resourceType *v2.ResourceType, objectID interface{}, resourceOptions ...ResourceOption) (*v2.Resource, error)
NewResource returns a new resource instance with no traits.
func NewResourceID ¶
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 NewResourceType ¶
func NewResourceType(name string, requiredTraits []v2.ResourceType_Trait, msgs ...proto.Message) *v2.ResourceType
NewResourceType returns a new *v2.ResourceType where the id is the name lowercased with spaces replaced by hyphens.
func NewRoleResource ¶
func NewRoleResource( name string, resourceType *v2.ResourceType, objectID interface{}, roleTraitOpts []RoleTraitOption, opts ...ResourceOption, ) (*v2.Resource, error)
NewRoleResource returns a new resource instance with a configured role trait. The trait is configured with the provided profile.
func NewRoleTrait ¶
func NewRoleTrait(opts ...RoleTraitOption) (*v2.RoleTrait, error)
NewRoleTrait creates a new `RoleTrait` with the provided profile.
func NewUserResource ¶
func NewUserResource( name string, resourceType *v2.ResourceType, objectID interface{}, userTraitOpts []UserTraitOption, opts ...ResourceOption, ) (*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(opts ...UserTraitOption) (*v2.UserTrait, error)
NewUserTrait creates a new `UserTrait`.
Types ¶
type AppTraitOption ¶
func WithAppFlags ¶ added in v0.1.4
func WithAppFlags(flags ...v2.AppTrait_AppFlag) AppTraitOption
func WithAppHelpURL ¶
func WithAppHelpURL(helpURL string) AppTraitOption
func WithAppIcon ¶
func WithAppIcon(assetRef *v2.AssetRef) AppTraitOption
func WithAppLogo ¶
func WithAppLogo(assetRef *v2.AssetRef) AppTraitOption
func WithAppProfile ¶
func WithAppProfile(profile map[string]interface{}) AppTraitOption
type GroupTraitOption ¶
type GroupTraitOption func(gt *v2.GroupTrait) error
func WithGroupIcon ¶
func WithGroupIcon(assetRef *v2.AssetRef) GroupTraitOption
func WithGroupProfile ¶
func WithGroupProfile(profile map[string]interface{}) GroupTraitOption
type ResourceOption ¶
func WithAnnotation ¶
func WithAnnotation(msgs ...proto.Message) ResourceOption
func WithAppTrait ¶
func WithAppTrait(opts ...AppTraitOption) ResourceOption
func WithDescription ¶ added in v0.1.0
func WithDescription(description string) ResourceOption
func WithGroupTrait ¶
func WithGroupTrait(opts ...GroupTraitOption) ResourceOption
func WithParentResourceID ¶
func WithParentResourceID(parentResourceID *v2.ResourceId) ResourceOption
func WithRoleTrait ¶
func WithRoleTrait(opts ...RoleTraitOption) ResourceOption
func WithUserTrait ¶
func WithUserTrait(opts ...UserTraitOption) ResourceOption
type RoleTraitOption ¶
func WithRoleProfile ¶
func WithRoleProfile(profile map[string]interface{}) RoleTraitOption
type UserTraitOption ¶
func WithAccountType ¶
func WithAccountType(accountType v2.UserTrait_AccountType) UserTraitOption
func WithEmail ¶
func WithEmail(email string, primary bool) UserTraitOption
func WithStatus ¶
func WithStatus(status v2.UserTrait_Status_Status) UserTraitOption
func WithUserIcon ¶
func WithUserIcon(assetRef *v2.AssetRef) UserTraitOption
func WithUserLogin ¶ added in v0.1.7
func WithUserLogin(login string, aliases ...string) UserTraitOption
func WithUserProfile ¶
func WithUserProfile(profile map[string]interface{}) UserTraitOption