Documentation
¶
Overview ¶
Package client is the client for interacting with the governor API
Index ¶
- Variables
- type Client
- func (c *Client) AddGroupMember(ctx context.Context, groupID, userID string, admin bool) error
- func (c *Client) AddGroupToApplication(ctx context.Context, groupID, appID string) error
- func (c *Client) AddGroupToOrganization(ctx context.Context, groupID, orgID string) error
- func (c *Client) AddMemberGroup(ctx context.Context, parentGroupID, memberGroupID string, expiresAt null.Time) error
- func (c *Client) Application(ctx context.Context, id string) (*v1alpha1.Application, error)
- func (c *Client) ApplicationGroups(ctx context.Context, id string) ([]*v1alpha1.Group, error)
- func (c *Client) ApplicationType(ctx context.Context, id string) (*v1alpha1.ApplicationType, error)
- func (c *Client) ApplicationTypeApps(ctx context.Context, id string) ([]*v1alpha1.Application, error)
- func (c *Client) ApplicationTypes(ctx context.Context) ([]*v1alpha1.ApplicationType, error)
- func (c *Client) Applications(ctx context.Context) ([]*v1alpha1.Application, error)
- func (c *Client) CreateGroup(ctx context.Context, group *v1alpha1.GroupReq) (*v1alpha1.Group, error)
- func (c *Client) CreateNotificationTarget(ctx context.Context, ntReq *v1alpha1.NotificationTargetReq) (*v1alpha1.NotificationTarget, error)
- func (c *Client) CreateNotificationType(ctx context.Context, ntReq *v1alpha1.NotificationTypeReq) (*v1alpha1.NotificationType, error)
- func (c *Client) CreateUser(ctx context.Context, user *v1alpha1.UserReq) (*v1alpha1.User, error)
- func (c *Client) DeleteGroup(ctx context.Context, id string) error
- func (c *Client) DeleteMemberGroup(ctx context.Context, parentGroupID, memberGroupID string) error
- func (c *Client) DeleteNotificationTarget(ctx context.Context, idOrSlug string) error
- func (c *Client) DeleteNotificationType(ctx context.Context, idOrSlug string) error
- func (c *Client) DeleteUser(ctx context.Context, id string) error
- func (c *Client) Group(ctx context.Context, id string, deleted bool) (*v1alpha1.Group, error)
- func (c *Client) GroupHierarchies(ctx context.Context) (*[]v1alpha1.GroupHierarchy, error)
- func (c *Client) GroupMemberRequests(ctx context.Context, id string) ([]*v1alpha1.GroupMemberRequest, error)
- func (c *Client) GroupMembers(ctx context.Context, id string) ([]*v1alpha1.GroupMember, error)
- func (c *Client) GroupMembersAll(ctx context.Context, expired bool) ([]*v1alpha1.GroupMembership, error)
- func (c *Client) GroupMembershipRequestsAll(ctx context.Context, expired bool) ([]*v1alpha1.GroupMemberRequest, error)
- func (c *Client) Groups(ctx context.Context) ([]*v1alpha1.Group, error)
- func (c *Client) MemberGroups(ctx context.Context, id string) (*[]v1alpha1.GroupHierarchy, error)
- func (c *Client) NotificationPreferences(ctx context.Context, userID string) (v1alpha1.UserNotificationPreferences, error)
- func (c *Client) NotificationTarget(ctx context.Context, idOrSlug string, deleted bool) (*v1alpha1.NotificationTarget, error)
- func (c *Client) NotificationTargets(ctx context.Context, deleted bool) ([]*v1alpha1.NotificationTarget, error)
- func (c *Client) NotificationType(ctx context.Context, idOrSlug string, deleted bool) (*v1alpha1.NotificationType, error)
- func (c *Client) NotificationTypes(ctx context.Context, deleted bool) ([]*v1alpha1.NotificationType, error)
- func (c *Client) Organization(ctx context.Context, id string) (*v1alpha1.Organization, error)
- func (c *Client) Organizations(ctx context.Context) ([]*v1alpha1.Organization, error)
- func (c *Client) RemoveGroupFromApplication(ctx context.Context, groupID, appID string) error
- func (c *Client) RemoveGroupFromOrganization(ctx context.Context, groupID, orgID string) error
- func (c *Client) RemoveGroupMember(ctx context.Context, groupID, userID string) error
- func (c *Client) RemoveGroupMembershipRequest(ctx context.Context, groupID, requestID string) error
- func (c *Client) URL() string
- func (c *Client) UpdateMemberGroup(ctx context.Context, parentGroupID, memberGroupID string, expiresAt null.Time) error
- func (c *Client) UpdateNotificationTarget(ctx context.Context, idOrSlug string, ntReq *v1alpha1.NotificationTargetReq) (*v1alpha1.NotificationTarget, error)
- func (c *Client) UpdateNotificationType(ctx context.Context, idOrSlug string, ntReq *v1alpha1.NotificationTypeReq) (*v1alpha1.NotificationType, error)
- func (c *Client) UpdateUser(ctx context.Context, id string, user *v1alpha1.UserReq) (*v1alpha1.User, error)
- func (c *Client) User(ctx context.Context, id string, deleted bool) (*v1alpha1.User, error)
- func (c *Client) Users(ctx context.Context, deleted bool) ([]*v1alpha1.User, error)
- func (c *Client) UsersQuery(ctx context.Context, query map[string][]string) ([]*v1alpha1.User, error)
- func (c *Client) UsersQueryV2(ctx context.Context, query map[string][]string) (*v1beta1.PaginationResponse[*v1beta1.User], error)
- func (c *Client) UsersV2(ctx context.Context, queryParams map[string][]string) ([]*v1beta1.User, error)
- type HTTPDoer
- type Option
- type Tokener
Constants ¶
This section is empty.
Variables ¶
var ( // ErrRequestNonSuccess is returned when a call to the governor API returns a non-success status ErrRequestNonSuccess = errors.New("got a non-success response from governor") // ErrGroupNotFound is returned when a group is not found ErrGroupNotFound = errors.New("group not found") // ErrMissingGroupID is returned when a missing or bad group id is passed to a request ErrMissingGroupID = errors.New("missing group id in request") // ErrMissingOrganizationID is returned when a missing or bad organization id is passed to a request ErrMissingOrganizationID = errors.New("missing organization id in request") // ErrMissingApplicationID is returned when a missing or bad application id is passed to a request ErrMissingApplicationID = errors.New("missing application id in request") // ErrMissingApplicationTypeID is returned when a missing or bad application_type id is passed to a request ErrMissingApplicationTypeID = errors.New("missing application_type id in request") // ErrMissingUserID is returned when a missing or bad user id is passed to a request ErrMissingUserID = errors.New("missing user id in request") // ErrMissingRequestID is returned when a missing or bad request id is passed to a request ErrMissingRequestID = errors.New("missing request id in request") // ErrNilUserRequest is returned when a nil user body is passed to a request ErrNilUserRequest = errors.New("nil user request") // ErrNilGroupRequest is returned when a nil group body is passed to a request ErrNilGroupRequest = errors.New("nil group request") // ErrUserNotFound is returned when a user is expected to be returned but instead is not ErrUserNotFound = errors.New("user not found") // ErrNotificationTypeNotFound is returned when a notification type is not found ErrNotificationTypeNotFound = errors.New("notification type not found") // ErrMissingNotificationTypeID is returned when a a missing or bad notification type ID is passed to a request ErrMissingNotificationTypeID = errors.New("missing notification type id in request") // ErrNotificationTargetNotFound is returned when a notification target is not found ErrNotificationTargetNotFound = errors.New("notification target not found") // ErrMissingNotificationTargetID is returned when a a missing or bad notification target ID is passed to a request ErrMissingNotificationTargetID = errors.New("missing notification target id in request") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a governor API client
func (*Client) AddGroupMember ¶
AddGroupMember adds a user to a group in governor
func (*Client) AddGroupToApplication ¶
AddGroupToApplication links the group to the application
func (*Client) AddGroupToOrganization ¶
AddGroupToOrganization links the group to the organization
func (*Client) AddMemberGroup ¶ added in v0.1.3
func (c *Client) AddMemberGroup(ctx context.Context, parentGroupID, memberGroupID string, expiresAt null.Time) error
AddMemberGroup creates a new group hierarchy relationship in governor
func (*Client) Application ¶
Application gets the details of an app from governor
func (*Client) ApplicationGroups ¶
ApplicationGroups gets a list of groups linked to the given governor application
func (*Client) ApplicationType ¶
ApplicationType gets the details of an application type from governor
func (*Client) ApplicationTypeApps ¶
func (c *Client) ApplicationTypeApps(ctx context.Context, id string) ([]*v1alpha1.Application, error)
ApplicationTypeApps gets a list of governor applications with the given application type
func (*Client) ApplicationTypes ¶
ApplicationTypes gets the list of application types from governor
func (*Client) Applications ¶
Applications gets the list of applications from governor
func (*Client) CreateGroup ¶
func (c *Client) CreateGroup(ctx context.Context, group *v1alpha1.GroupReq) (*v1alpha1.Group, error)
CreateGroup creates a new group in governor
func (*Client) CreateNotificationTarget ¶ added in v0.1.5
func (c *Client) CreateNotificationTarget( ctx context.Context, ntReq *v1alpha1.NotificationTargetReq, ) (*v1alpha1.NotificationTarget, error)
CreateNotificationTarget creates a notification target
func (*Client) CreateNotificationType ¶ added in v0.1.5
func (c *Client) CreateNotificationType( ctx context.Context, ntReq *v1alpha1.NotificationTypeReq, ) (*v1alpha1.NotificationType, error)
CreateNotificationType creates a notification type
func (*Client) CreateUser ¶
CreateUser creates a user in governor and returns the user
func (*Client) DeleteGroup ¶
DeleteGroup deletes a group from governor
func (*Client) DeleteMemberGroup ¶ added in v0.1.3
DeleteMemberGroup deletes a group hierarchy relationship in governor
func (*Client) DeleteNotificationTarget ¶ added in v0.1.5
DeleteNotificationTarget deletes a notification target
func (*Client) DeleteNotificationType ¶ added in v0.1.5
DeleteNotificationType deletes a notification type
func (*Client) DeleteUser ¶
DeleteUser deletes a user in governor
func (*Client) GroupHierarchies ¶ added in v0.1.3
GroupHierarchies lists all hierarchical group relationships in governor
func (*Client) GroupMemberRequests ¶
func (c *Client) GroupMemberRequests(ctx context.Context, id string) ([]*v1alpha1.GroupMemberRequest, error)
GroupMemberRequests returns a list of member requests in the given governor group
func (*Client) GroupMembers ¶
GroupMembers returns a list of users in the given governor group
func (*Client) GroupMembersAll ¶
func (c *Client) GroupMembersAll(ctx context.Context, expired bool) ([]*v1alpha1.GroupMembership, error)
GroupMembersAll returns a list of all group memberships across all groups
func (*Client) GroupMembershipRequestsAll ¶
func (c *Client) GroupMembershipRequestsAll(ctx context.Context, expired bool) ([]*v1alpha1.GroupMemberRequest, error)
GroupMembershipRequestsAll returns all group membership requests across all users and groups
func (*Client) MemberGroups ¶ added in v0.1.3
MemberGroups lists member groups of a parent group in governor
func (*Client) NotificationPreferences ¶ added in v0.1.5
func (c *Client) NotificationPreferences(ctx context.Context, userID string) (v1alpha1.UserNotificationPreferences, error)
NotificationPreferences list all notification preferences for a user
func (*Client) NotificationTarget ¶ added in v0.1.5
func (c *Client) NotificationTarget(ctx context.Context, idOrSlug string, deleted bool) (*v1alpha1.NotificationTarget, error)
NotificationTarget fetch a notification target
func (*Client) NotificationTargets ¶ added in v0.1.5
func (c *Client) NotificationTargets(ctx context.Context, deleted bool) ([]*v1alpha1.NotificationTarget, error)
NotificationTargets list all notification targets
func (*Client) NotificationType ¶ added in v0.1.5
func (c *Client) NotificationType(ctx context.Context, idOrSlug string, deleted bool) (*v1alpha1.NotificationType, error)
NotificationType fetch a notification type
func (*Client) NotificationTypes ¶ added in v0.1.5
func (c *Client) NotificationTypes(ctx context.Context, deleted bool) ([]*v1alpha1.NotificationType, error)
NotificationTypes list all notification types
func (*Client) Organization ¶
Organization gets the details of an org from governor
func (*Client) Organizations ¶
Organizations gets the list of organizations from governor
func (*Client) RemoveGroupFromApplication ¶
RemoveGroupFromApplication unlinks the group from the application
func (*Client) RemoveGroupFromOrganization ¶
RemoveGroupFromOrganization unlinks the group from the organization
func (*Client) RemoveGroupMember ¶
RemoveGroupMember removes a user from a group in governor
func (*Client) RemoveGroupMembershipRequest ¶
RemoveGroupMembershipRequest removes a user from a group in governor
func (*Client) UpdateMemberGroup ¶ added in v0.1.3
func (c *Client) UpdateMemberGroup(ctx context.Context, parentGroupID, memberGroupID string, expiresAt null.Time) error
UpdateMemberGroup updates the expiration on a group hierarchy relationship in governor
func (*Client) UpdateNotificationTarget ¶ added in v0.1.5
func (c *Client) UpdateNotificationTarget( ctx context.Context, idOrSlug string, ntReq *v1alpha1.NotificationTargetReq, ) (*v1alpha1.NotificationTarget, error)
UpdateNotificationTarget updates a notification target
func (*Client) UpdateNotificationType ¶ added in v0.1.5
func (c *Client) UpdateNotificationType( ctx context.Context, idOrSlug string, ntReq *v1alpha1.NotificationTypeReq, ) (*v1alpha1.NotificationType, error)
UpdateNotificationType updates a notification type
func (*Client) UpdateUser ¶
func (c *Client) UpdateUser(ctx context.Context, id string, user *v1alpha1.UserReq) (*v1alpha1.User, error)
UpdateUser updates a user in governor and returns the user
func (*Client) User ¶
User gets the details of a user from governor when deleted is true it will return information about a deleted user
func (*Client) Users ¶
Users gets the list of users from governor when deleted is true it will also return deleted users
func (*Client) UsersQuery ¶
func (c *Client) UsersQuery(ctx context.Context, query map[string][]string) ([]*v1alpha1.User, error)
UsersQuery searches for a user in governor with the passed query
type Option ¶
type Option func(r *Client)
Option is a functional configuration option
func WithClientCredentialConfig ¶
func WithClientCredentialConfig(c *clientcredentials.Config) Option
WithClientCredentialConfig sets the oauth client credential config
func WithHTTPClient ¶
WithHTTPClient overrides the default http client