v1alpha1

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: Apache-2.0 Imports: 27 Imported by: 5

Documentation

Overview

Package v1alpha1 is the v1alpha version of the api

Index

Constants

View Source
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
)
View Source
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"
)
View Source
const (
	// Version is the API version constant
	Version = "v1alpha1"
)

Variables

View Source
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")
)

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"`
	Kind            string  `json:"kind"` // TODO: remove after type_id is fully integrated
	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

type AuthenticatedUser struct {
	*User
	Admin bool `json:"admin"`
}

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 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"`
	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"`
}

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"`
}

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"`
}

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 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 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

Jump to

Keyboard shortcuts

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