Documentation ¶
Overview ¶
Package v1alpha1 is the v1alpha version of the api
Index ¶
- Constants
- Variables
- type Application
- type ApplicationReq
- type ApplicationType
- type ApplicationTypeReq
- type AuthenticatedUser
- type AuthenticatedUserGroup
- type AuthenticatedUserGroupApplicationRequest
- type AuthenticatedUserGroupMemberRequest
- type AuthenticatedUserReq
- type AuthenticatedUserRequests
- type EventsResponse
- type Extension
- type ExtensionReq
- type ExtensionResourceDefinition
- type ExtensionResourceDefinitionReq
- type ExtensionResourceDefinitionScope
- type Group
- type GroupApplicationRequest
- type GroupHierarchy
- type GroupMember
- type GroupMemberRequest
- type GroupMembership
- type GroupReq
- type NotificationTarget
- type NotificationTargetReq
- type NotificationType
- type NotificationTypeReq
- type Organization
- type OrganizationReq
- type PaginationParams
- type Router
- type SerializableEvents
- type SystemExtensionResource
- type User
- type UserExtensionResource
- type UserNotificationPreferenceTargets
- type UserNotificationPreferences
- type UserReq
Constants ¶
const ( // AuthRoleUser indicates an authenticated user with regular user privileges AuthRoleUser mwAuthRole = iota // AuthRoleAdmin indicates an authenticated user who is a governor admin AuthRoleAdmin // AuthRoleGroupMember indicates an authenticated user who is a member of the given group AuthRoleGroupMember // AuthRoleGroupAdmin indicates an authenticated user who is an admin in the given group AuthRoleGroupAdmin // AuthRoleAdminOrGroupAdmin indicates an authenticated user who is an admin in the given group or governor admin AuthRoleAdminOrGroupAdmin // AuthRoleAdminOrGroupAdminOrGroupApprover indicates an authenticated user who is an admin in the given group or governor admin or a member of the approver group AuthRoleAdminOrGroupAdminOrGroupApprover )
const ( // NewMemberRequest represents requests from non-members to join a group NewMemberRequest string = "new_member" // AdminPromotionRequest represents requests from members to promote to admin access AdminPromotionRequest string = "admin_promotion" )
const ( // UserStatusActive is the status for an active user UserStatusActive = "active" // UserStatusPending is the status for a pending user UserStatusPending = "pending" // UserStatusSuspended is the status for a suspended user UserStatusSuspended = "suspended" )
const (
// Version is the API version constant
Version = "v1alpha1"
)
Variables ¶
var ( // ErrInvalidChar is returned when use input contains invalid character(s) ErrInvalidChar = errors.New("invalid characters in group name string") // ErrEmptyInput is returned when user input is empty ErrEmptyInput = errors.New("name or description cannot be empty") // ErrUnknownRequestKind is returned a request kind is unknown ErrUnknownRequestKind = errors.New("request kind is unrecognized") // ErrGetDeleteResourcedWithSlug is returned when user tries to query a deleted // resource with slug ErrGetDeleteResourcedWithSlug = errors.New("unable to get deleted resource by slug, use the id") // ErrExtensionNotFound is returned when an extension is not found ErrExtensionNotFound = errors.New("extension does not exist") // ErrERDNotFound is returned when an extension resource definition is not found ErrERDNotFound = errors.New("ERD does not exist") // ErrNoUserProvided is returned when no user is provided ErrNoUserProvided = errors.New("neither user-id nor context user were provided") // ErrExtensionResourceNotFound is returned when an extension resource is not found ErrExtensionResourceNotFound = errors.New("extension resource does not exist") // ErrUserNotFound is returned when a user is not found ErrUserNotFound = errors.New("user does not exist") )
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct { *models.Application Type *models.ApplicationType `json:"type"` }
Application is the application response
type ApplicationReq ¶
type ApplicationReq struct { Name string `json:"name"` TypeID string `json:"type_id"` ApproverGroupID *string `json:"approver_group_id"` }
ApplicationReq is a request to create an application
type ApplicationType ¶
type ApplicationType struct {
*models.ApplicationType
}
ApplicationType is the application type response
type ApplicationTypeReq ¶
type ApplicationTypeReq struct { Name string `json:"name"` Description string `json:"description"` LogoURL *string `json:"logo_url,omitempty"` }
ApplicationTypeReq is a request to create an application type
type AuthenticatedUser ¶
AuthenticatedUser is an authenticated user response
type AuthenticatedUserGroup ¶
type AuthenticatedUserGroup struct { *models.Group Organizations models.OrganizationSlice `json:"organizations"` Applications models.ApplicationSlice `json:"applications"` Admin bool `json:"admin"` Direct bool `json:"direct"` }
AuthenticatedUserGroup is an authenticated user group response
type AuthenticatedUserGroupApplicationRequest ¶
type AuthenticatedUserGroupApplicationRequest struct {
*GroupApplicationRequest
}
AuthenticatedUserGroupApplicationRequest is an authenticated user group application request
type AuthenticatedUserGroupMemberRequest ¶
type AuthenticatedUserGroupMemberRequest struct { *GroupMemberRequest Admin bool `json:"admin"` }
AuthenticatedUserGroupMemberRequest is an authenticated user group membership request
type AuthenticatedUserReq ¶
type AuthenticatedUserReq struct { AvatarURL *string `json:"avatar_url"` GithubUsername *string `json:"github_username"` NotificationPreferences UserNotificationPreferences `json:"notification_preferences,omitempty"` }
AuthenticatedUserReq is an authenticated user request payload for updating selected details
type AuthenticatedUserRequests ¶
type AuthenticatedUserRequests struct { ApplicationRequests []AuthenticatedUserGroupApplicationRequest `json:"application_requests"` MemberRequests []AuthenticatedUserGroupMemberRequest `json:"member_requests"` }
AuthenticatedUserRequests is a list of application and member requests for the authenticated user
type EventsResponse ¶
type EventsResponse struct { PageSize int `json:"page_size,omitempty"` Page int `json:"page,omitempty"` PageCount int `json:"page_count,omitempty"` TotalPages int `json:"total_pages,omitempty"` TotalRecordCount int64 `json:"total_record_count,omitempty"` Records models.AuditEventSlice `json:"records,omitempty"` }
EventsResponse is the response returned from a request for audit events
type ExtensionReq ¶ added in v0.2.0
type ExtensionReq struct { Name string `json:"name"` Description string `json:"description"` Enabled *bool `json:"enabled,omitempty"` }
ExtensionReq is a request to create an extension
type ExtensionResourceDefinition ¶ added in v0.2.0
type ExtensionResourceDefinition struct {
*models.ExtensionResourceDefinition
}
ExtensionResourceDefinition is the extension resource definition response
type ExtensionResourceDefinitionReq ¶ added in v0.2.0
type ExtensionResourceDefinitionReq struct { Name string `json:"name"` Description string `json:"description"` SlugSingular string `json:"slug_singular"` SlugPlural string `json:"slug_plural"` Version string `json:"version"` Scope ExtensionResourceDefinitionScope `json:"scope"` Schema json.RawMessage `json:"schema"` Enabled *bool `json:"enabled"` }
ExtensionResourceDefinitionReq is a request to create an extension resource definition
type ExtensionResourceDefinitionScope ¶ added in v0.2.0
type ExtensionResourceDefinitionScope string
ExtensionResourceDefinitionScope is an enum type for scopes in an ERD
const ( // ExtensionResourceDefinitionScopeUser represents the `user` scope ExtensionResourceDefinitionScopeUser ExtensionResourceDefinitionScope = "user" // ExtensionResourceDefinitionScopeSys represents the `system` scope ExtensionResourceDefinitionScopeSys ExtensionResourceDefinitionScope = "system" )
func (ExtensionResourceDefinitionScope) String ¶ added in v0.2.0
func (scope ExtensionResourceDefinitionScope) String() string
String converts an ExtensionResourceDefinitionScope to a string
type Group ¶
type Group struct { *models.Group Members []string `json:"members,omitempty"` MembersDirect []string `json:"members_direct,omitempty"` MembershipRequests []string `json:"membership_requests,omitempty"` Organizations []string `json:"organizations"` Applications []string `json:"applications"` }
Group is a group response
type GroupApplicationRequest ¶
type GroupApplicationRequest struct { ID string `json:"id"` ApplicationID string `json:"application_id"` ApplicationName string `json:"application_name"` ApplicationSlug string `json:"application_slug"` ApproverGroupID string `json:"approver_group_id"` ApproverGroupName string `json:"approver_group_name"` ApproverGroupSlug string `json:"approver_group_slug"` GroupID string `json:"group_id"` GroupName string `json:"group_name"` GroupSlug string `json:"group_slug"` RequesterUserID string `json:"requester_user_id"` RequesterUserName string `json:"requester_user_name"` RequesterUserEmail string `json:"requester_user_email"` RequesterUserAvatarURL string `json:"requester_user_avatar_url"` Note string `json:"note"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
GroupApplicationRequest is a pending request to link an application to a group
type GroupHierarchy ¶ added in v0.1.3
type GroupHierarchy struct { ID string `json:"id"` ParentGroupID string `json:"parent_group_id"` ParentGroupSlug string `json:"parent_group_slug"` MemberGroupID string `json:"member_group_id"` MemberGroupSlug string `json:"member_group_slug"` ExpiresAt null.Time `json:"expires_at"` }
GroupHierarchy is the relationship between a parent group and a member group
type GroupMember ¶
type GroupMember struct { ID string `json:"id"` Name string `json:"name"` Email string `json:"email"` AvatarURL string `json:"avatar_url"` Status string `json:"status"` IsAdmin bool `json:"is_admin"` ExpiresAt null.Time `json:"expires_at"` AdminExpiresAt null.Time `json:"admin_expires_at"` Direct bool `json:"direct"` }
GroupMember is a group member (user)
type GroupMemberRequest ¶
type GroupMemberRequest struct { ID string `json:"id"` GroupID string `json:"group_id"` GroupName string `json:"group_name"` GroupSlug string `json:"group_slug"` UserID string `json:"user_id"` UserName string `json:"user_name"` UserEmail string `json:"user_email"` UserAvatarURL string `json:"user_avatar_url"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` IsAdmin bool `json:"is_admin"` Note string `json:"note"` ExpiresAt null.Time `json:"expires_at"` AdminExpiresAt null.Time `json:"admin_expires_at"` Kind string `json:"kind"` }
GroupMemberRequest is a pending user request for group membership
type GroupMembership ¶
type GroupMembership struct { ID string `json:"id"` GroupID string `json:"group_id"` GroupSlug string `json:"group_slug"` UserID string `json:"user_id"` UserEmail string `json:"user_email"` ExpiresAt null.Time `json:"expires_at"` IsAdmin bool `json:"is_admin"` AdminExpiresAt null.Time `json:"admin_expires_at"` }
GroupMembership is the relationship between user and groups
type GroupReq ¶
type GroupReq struct { Name string `json:"name"` Description string `json:"description"` Note string `json:"note"` ApproverGroupID string `json:"approver_group_id,omitempty"` }
GroupReq is a group creation/update request
type NotificationTarget ¶ added in v0.1.5
type NotificationTarget struct {
*models.NotificationTarget
}
NotificationTarget is the notification target response
type NotificationTargetReq ¶ added in v0.1.5
type NotificationTargetReq struct { Name string `json:"name"` Description string `json:"description"` DefaultEnabled *bool `json:"default_enabled"` }
NotificationTargetReq is a request to create a notification target
type NotificationType ¶ added in v0.1.5
type NotificationType struct {
*models.NotificationType
}
NotificationType is the notification type response
type NotificationTypeReq ¶ added in v0.1.5
type NotificationTypeReq struct { Name string `json:"name"` Description string `json:"description"` DefaultEnabled *bool `json:"default_enabled"` }
NotificationTypeReq is a request to create a notification type
type Organization ¶
type Organization struct {
*models.Organization
}
Organization is the organization response
type OrganizationReq ¶
type OrganizationReq struct {
Name string `json:"name"`
}
OrganizationReq is a request to create an organization
type PaginationParams ¶
type PaginationParams struct { Limit int `json:"limit,omitempty"` Page int `json:"page,omitempty"` Cursor string `json:"cursor,omitempty"` Preload bool `json:"preload,omitempty"` OrderBy string `json:"orderby,omitempty"` }
PaginationParams allow you to paginate the results
type Router ¶
type Router struct { AdminGroups []string AuditLogWriter io.Writer AuditMW *ginaudit.Middleware AuthMW *ginauth.MultiTokenMiddleware AuthConf []ginjwt.AuthConfig DB *sqlx.DB EventBus *eventbus.Client Logger *zap.Logger }
Router is the API router
func (*Router) Routes ¶
func (r *Router) Routes(rg *gin.RouterGroup)
Routes sets up protected routes and sets the scopes for said routes
type SerializableEvents ¶
type SerializableEvents interface { *models.AuditEvent | []*models.AuditEvent }
SerializableEvents are audit events that can be serialized into a json.RawMessage
type SystemExtensionResource ¶ added in v0.2.0
type SystemExtensionResource struct { *models.SystemExtensionResource ERD string `json:"extension_resource_definition"` Version string `json:"version"` }
SystemExtensionResource is the system extension resource response
type User ¶
type User struct { *models.User Memberships []string `json:"memberships,omitempty"` MembershipsDirect []string `json:"memberships_direct,omitempty"` MembershipRequests []string `json:"membership_requests,omitempty"` NotificationPreferences dbtools.UserNotificationPreferences `json:"notification_preferences,omitempty"` }
User is a user response
type UserExtensionResource ¶ added in v0.2.0
type UserExtensionResource struct { *models.UserExtensionResource ERD string `json:"extension_resource_definition"` Version string `json:"version"` }
UserExtensionResource is the user extension resource response
type UserNotificationPreferenceTargets ¶ added in v0.1.5
type UserNotificationPreferenceTargets = dbtools.UserNotificationPreferenceTargets
UserNotificationPreferenceTargets is an alias export for the same struct in dbtools
type UserNotificationPreferences ¶ added in v0.1.5
type UserNotificationPreferences = dbtools.UserNotificationPreferences
UserNotificationPreferences is an alias export for the same struct in dbtools
type UserReq ¶
type UserReq struct { AvatarURL string `json:"avatar_url,omitempty"` Email string `json:"email"` ExternalID string `json:"external_id"` GithubID string `json:"github_id,omitempty"` GithubUsername string `json:"github_username,omitempty"` Name string `json:"name"` Status string `json:"status,omitempty"` }
UserReq is a user request payload
Source Files ¶
- application_types.go
- applications.go
- auth.go
- authenticated_user.go
- concurrency_control.go
- doc.go
- errors.go
- events.go
- extension_lifecycle.go
- extension_resource_definitions.go
- extensions.go
- group_applications.go
- group_hierarchies.go
- group_membership.go
- group_organizations.go
- groups.go
- notification_preferences.go
- notifications_target.go
- notifications_types.go
- organizations.go
- router.go
- sys_extension_resources.go
- testing.go
- user_extension_resources.go
- users.go