team

package
v0.0.0-...-8bea463 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMember

func AddMember(ctx context.Context, input AddTeamMemberInput, actor *authz.Actor) error

func ConfirmDeleteKey

func ConfirmDeleteKey(ctx context.Context, teamSlug slug.Slug, deleteKey uuid.UUID, actor *authz.Actor) error

func Count

func Count(ctx context.Context) (int64, error)

func Exists

func Exists(ctx context.Context, slug slug.Slug) (bool, error)

Exists checks if an active team with the given slug exists.

func ListAllSlugs

func ListAllSlugs(ctx context.Context) ([]slug.Slug, error)

func NamespaceExists

func NamespaceExists(ctx context.Context, teamSlug slug.Slug) bool

func NewLoaderContext

func NewLoaderContext(ctx context.Context, dbConn *pgxpool.Pool, namespaceWatcher *watcher.Watcher[*corev1.Namespace]) context.Context

func NewNamespaceWatcher

func NewNamespaceWatcher(ctx context.Context, mgr *watcher.Manager) *watcher.Watcher[*corev1.Namespace]

func RemoveMember

func RemoveMember(ctx context.Context, input RemoveTeamMemberInput, actor *authz.Actor) error
func Search(ctx context.Context, q string) ([]*search.Result, error)

func SetMemberRole

func SetMemberRole(ctx context.Context, input SetTeamMemberRoleInput, actor *authz.Actor) error

func UpdateExternalReferences

func UpdateExternalReferences(ctx context.Context, teamSlug slug.Slug, references *ExternalReferences) error

func UserIsMember

func UserIsMember(ctx context.Context, teamSlug slug.Slug, userID uuid.UUID) (bool, error)

func UserIsOwner

func UserIsOwner(ctx context.Context, teamSlug slug.Slug, userID uuid.UUID) (bool, error)

Types

type AddTeamMemberInput

type AddTeamMemberInput struct {
	TeamSlug  slug.Slug      `json:"teamSlug"`
	UserEmail string         `json:"userEmail"`
	Role      TeamMemberRole `json:"role"`
	UserID    uuid.UUID      `json:"-"`
}

type AddTeamMemberPayload

type AddTeamMemberPayload struct {
	Member *TeamMember `json:"member"`
}

type ConfirmTeamDeletionInput

type ConfirmTeamDeletionInput struct {
	Key  string    `json:"key"`
	Slug slug.Slug `json:"slug"`
}

type ConfirmTeamDeletionPayload

type ConfirmTeamDeletionPayload struct {
	DeletionStarted bool `json:"deletionStarted"`
}

type CreateTeamInput

type CreateTeamInput struct {
	Slug         slug.Slug `json:"slug"`
	Purpose      string    `json:"purpose"`
	SlackChannel string    `json:"slackChannel"`
}

func (*CreateTeamInput) Validate

func (i *CreateTeamInput) Validate(ctx context.Context) error

type CreateTeamPayload

type CreateTeamPayload struct {
	Team *Team `json:"team"`
}

type ErrNotFound

type ErrNotFound struct {
	// contains filtered or unexported fields
}

func (*ErrNotFound) As

func (e *ErrNotFound) As(v any) bool

func (ErrNotFound) Error

func (e ErrNotFound) Error() string

func (ErrNotFound) GraphError

func (e ErrNotFound) GraphError() string

func (*ErrNotFound) Is

func (e *ErrNotFound) Is(v error) bool

type ExternalReferences

type ExternalReferences struct {
	GoogleGroupEmail *string
	EntraIDGroupID   *uuid.UUID
	GithubTeamSlug   *string
	GarRepository    *string
	CdnBucket        *string
}

type RemoveTeamMemberInput

type RemoveTeamMemberInput struct {
	TeamSlug  slug.Slug `json:"teamSlug"`
	UserEmail string    `json:"userEmail"`
	UserID    uuid.UUID `json:"-"`
}

type RemoveTeamMemberPayload

type RemoveTeamMemberPayload struct {
	UserID   uuid.UUID `json:"-"`
	TeamSlug slug.Slug `json:"-"`
}

type RequestTeamDeletionInput

type RequestTeamDeletionInput struct {
	Slug slug.Slug `json:"slug"`
}

type RequestTeamDeletionPayload

type RequestTeamDeletionPayload struct {
	Key *TeamDeleteKey `json:"key"`
}

type SetTeamMemberRoleInput

type SetTeamMemberRoleInput struct {
	TeamSlug  slug.Slug      `json:"teamSlug"`
	UserEmail string         `json:"userEmail"`
	Role      TeamMemberRole `json:"role"`
	UserID    uuid.UUID      `json:"-"`
}

type SetTeamMemberRolePayload

type SetTeamMemberRolePayload struct {
	Member *TeamMember `json:"member"`
}

type Team

type Team struct {
	Slug                   slug.Slug  `json:"slug"`
	Purpose                string     `json:"purpose"`
	LastSuccessfulSync     *time.Time `json:"lastSuccessfulSync"`
	SlackChannel           string     `json:"slackChannel"`
	EntraIDGroupID         *string    `json:"-"`
	GitHubTeamSlug         *string    `json:"-"`
	GoogleGroupEmail       *string    `json:"-"`
	GoogleArtifactRegistry *string    `json:"-"`
	CdnBucket              *string    `json:"-"`
	DeleteKeyConfirmedAt   *time.Time `json:"-"`
}

func Create

func Create(ctx context.Context, input *CreateTeamInput, actor *authz.Actor) (*Team, error)

func Get

func Get(ctx context.Context, slug slug.Slug) (*Team, error)

func GetByIdent

func GetByIdent(ctx context.Context, id ident.Ident) (*Team, error)

func Update

func Update(ctx context.Context, input *UpdateTeamInput, actor *authz.Actor) (*Team, error)

func (Team) DeletionInProgress

func (t Team) DeletionInProgress() bool

func (*Team) ExternalResources

func (t *Team) ExternalResources() *TeamExternalResources

func (Team) ID

func (t Team) ID() ident.Ident

func (Team) IsNode

func (Team) IsNode()

func (Team) IsSearchNode

func (Team) IsSearchNode()

type TeamCDN

type TeamCDN struct {
	Bucket string `json:"bucket"`
}

type TeamConfirmDeleteKeyActivityLogEntry

type TeamConfirmDeleteKeyActivityLogEntry struct {
	activitylog.GenericActivityLogEntry
}

type TeamConnection

type TeamConnection = pagination.Connection[*Team]

func List

func List(ctx context.Context, page *pagination.Pagination, orderBy *TeamOrder) (*TeamConnection, error)

func ListBySlugs

func ListBySlugs(ctx context.Context, slugs []slug.Slug, page *pagination.Pagination) (*TeamConnection, error)

type TeamCreateDeleteKeyActivityLogEntry

type TeamCreateDeleteKeyActivityLogEntry struct {
	activitylog.GenericActivityLogEntry
}

type TeamCreatedActivityLogEntry

type TeamCreatedActivityLogEntry struct {
	activitylog.GenericActivityLogEntry
}

type TeamDeleteKey

type TeamDeleteKey struct {
	KeyUUID         uuid.UUID  `json:"key"`
	CreatedAt       time.Time  `json:"createdAt"`
	ConfirmedAt     *time.Time `json:"-"`
	CreatedByUserID uuid.UUID  `json:"-"`
	TeamSlug        slug.Slug  `json:"-"`
}

func CreateDeleteKey

func CreateDeleteKey(ctx context.Context, teamSlug slug.Slug, actor *authz.Actor) (*TeamDeleteKey, error)

func GetDeleteKey

func GetDeleteKey(ctx context.Context, teamSlug slug.Slug, key uuid.UUID) (*TeamDeleteKey, error)

func (*TeamDeleteKey) Expires

func (t *TeamDeleteKey) Expires() time.Time

func (*TeamDeleteKey) HasExpired

func (t *TeamDeleteKey) HasExpired() bool

func (TeamDeleteKey) Key

func (t TeamDeleteKey) Key() string

type TeamEdge

type TeamEdge = pagination.Edge[*Team]

type TeamEntraIDGroup

type TeamEntraIDGroup struct {
	GroupID string `json:"groupID"`
}

type TeamEnvironment

type TeamEnvironment struct {
	Name               string    `json:"name"`
	GCPProjectID       *string   `json:"gcpProjectID"`
	SlackAlertsChannel string    `json:"slackAlertsChannel"`
	TeamSlug           slug.Slug `json:"-"`
}

func GetTeamEnvironment

func GetTeamEnvironment(ctx context.Context, teamSlug slug.Slug, envName string) (*TeamEnvironment, error)

func GetTeamEnvironmentByIdent

func GetTeamEnvironmentByIdent(ctx context.Context, id ident.Ident) (*TeamEnvironment, error)

func ListTeamEnvironments

func ListTeamEnvironments(ctx context.Context, teamSlug slug.Slug) ([]*TeamEnvironment, error)

func UpdateEnvironment

func UpdateEnvironment(ctx context.Context, input *UpdateTeamEnvironmentInput, actor *authz.Actor) (*TeamEnvironment, error)

func (TeamEnvironment) ID

func (e TeamEnvironment) ID() ident.Ident

func (TeamEnvironment) IsNode

func (TeamEnvironment) IsNode()

type TeamEnvironmentUpdatedActivityLogEntry

type TeamEnvironmentUpdatedActivityLogEntry struct {
	activitylog.GenericActivityLogEntry
	Data *TeamEnvironmentUpdatedActivityLogEntryData `json:"data"`
}

type TeamEnvironmentUpdatedActivityLogEntryData

type TeamEnvironmentUpdatedActivityLogEntryData struct {
	UpdatedFields []*TeamEnvironmentUpdatedActivityLogEntryDataUpdatedField `json:"updatedFields"`
}

type TeamEnvironmentUpdatedActivityLogEntryDataUpdatedField

type TeamEnvironmentUpdatedActivityLogEntryDataUpdatedField struct {
	Field    string  `json:"field"`
	OldValue *string `json:"oldValue"`
	NewValue *string `json:"newValue"`
}

type TeamExternalResources

type TeamExternalResources struct {
	// contains filtered or unexported fields
}

func (*TeamExternalResources) CDN

func (t *TeamExternalResources) CDN() *TeamCDN

func (*TeamExternalResources) EntraIDGroup

func (t *TeamExternalResources) EntraIDGroup() *TeamEntraIDGroup

func (*TeamExternalResources) GitHubTeam

func (t *TeamExternalResources) GitHubTeam() *TeamGitHubTeam

func (*TeamExternalResources) GoogleArtifactRegistry

func (t *TeamExternalResources) GoogleArtifactRegistry() *TeamGoogleArtifactRegistry

func (*TeamExternalResources) GoogleGroup

func (t *TeamExternalResources) GoogleGroup() *TeamGoogleGroup

type TeamGitHubTeam

type TeamGitHubTeam struct {
	Slug string `json:"slug"`
}

type TeamGoogleArtifactRegistry

type TeamGoogleArtifactRegistry struct {
	Repository string `json:"repository"`
}

type TeamGoogleGroup

type TeamGoogleGroup struct {
	Email string `json:"email"`
}

type TeamInventoryCounts

type TeamInventoryCounts struct {
	TeamSlug slug.Slug `json:"-"`
}

type TeamMember

type TeamMember struct {
	Role     TeamMemberRole
	TeamSlug slug.Slug `json:"-"`
	UserID   uuid.UUID `json:"-"`
}

func GetMemberByEmail

func GetMemberByEmail(ctx context.Context, teamSlug slug.Slug, email string) (*TeamMember, error)

type TeamMemberAddedActivityLogEntry

type TeamMemberAddedActivityLogEntry struct {
	activitylog.GenericActivityLogEntry
	Data *TeamMemberAddedActivityLogEntryData `json:"data"`
}

type TeamMemberAddedActivityLogEntryData

type TeamMemberAddedActivityLogEntryData struct {
	Role      TeamMemberRole `json:"role"`
	UserUUID  uuid.UUID      `json:"userID"`
	UserEmail string         `json:"userEmail"`
}

func (TeamMemberAddedActivityLogEntryData) UserID

type TeamMemberConnection

type TeamMemberConnection = pagination.Connection[*TeamMember]

func ListForUser

func ListForUser(ctx context.Context, userID uuid.UUID, page *pagination.Pagination, orderBy *UserTeamOrder) (*TeamMemberConnection, error)

func ListMembers

func ListMembers(ctx context.Context, teamSlug slug.Slug, page *pagination.Pagination, orderBy *TeamMemberOrder) (*TeamMemberConnection, error)

type TeamMemberEdge

type TeamMemberEdge = pagination.Edge[*TeamMember]

type TeamMemberOrder

type TeamMemberOrder struct {
	Field     TeamMemberOrderField `json:"field"`
	Direction model.OrderDirection `json:"direction"`
}

func (*TeamMemberOrder) String

func (o *TeamMemberOrder) String() string

type TeamMemberOrderField

type TeamMemberOrderField string
const (
	TeamMemberOrderFieldName  TeamMemberOrderField = "NAME"
	TeamMemberOrderFieldEmail TeamMemberOrderField = "EMAIL"
	TeamMemberOrderFieldRole  TeamMemberOrderField = "ROLE"
)

func (TeamMemberOrderField) IsValid

func (e TeamMemberOrderField) IsValid() bool

func (TeamMemberOrderField) MarshalGQL

func (e TeamMemberOrderField) MarshalGQL(w io.Writer)

func (TeamMemberOrderField) String

func (e TeamMemberOrderField) String() string

func (*TeamMemberOrderField) UnmarshalGQL

func (e *TeamMemberOrderField) UnmarshalGQL(v interface{}) error

type TeamMemberRemovedActivityLogEntry

type TeamMemberRemovedActivityLogEntry struct {
	activitylog.GenericActivityLogEntry
	Data *TeamMemberRemovedActivityLogEntryData `json:"data"`
}

type TeamMemberRemovedActivityLogEntryData

type TeamMemberRemovedActivityLogEntryData struct {
	UserUUID  uuid.UUID `json:"userID"`
	UserEmail string    `json:"userEmail"`
}

func (TeamMemberRemovedActivityLogEntryData) UserID

type TeamMemberRole

type TeamMemberRole string
const (
	TeamMemberRoleMember TeamMemberRole = "MEMBER"
	TeamMemberRoleOwner  TeamMemberRole = "OWNER"
)

func (TeamMemberRole) IsValid

func (e TeamMemberRole) IsValid() bool

func (TeamMemberRole) MarshalGQL

func (e TeamMemberRole) MarshalGQL(w io.Writer)

func (TeamMemberRole) String

func (e TeamMemberRole) String() string

func (*TeamMemberRole) UnmarshalGQL

func (e *TeamMemberRole) UnmarshalGQL(v interface{}) error

type TeamMemberSetRoleActivityLogEntry

type TeamMemberSetRoleActivityLogEntry struct {
	activitylog.GenericActivityLogEntry
	Data *TeamMemberSetRoleActivityLogEntryData `json:"data"`
}

type TeamMemberSetRoleActivityLogEntryData

type TeamMemberSetRoleActivityLogEntryData struct {
	Role      TeamMemberRole `json:"role"`
	UserUUID  uuid.UUID      `json:"userID"`
	UserEmail string         `json:"userEmail"`
}

func (TeamMemberSetRoleActivityLogEntryData) UserID

type TeamOrder

type TeamOrder struct {
	Field     TeamOrderField       `json:"field"`
	Direction model.OrderDirection `json:"direction"`
}

func (*TeamOrder) String

func (o *TeamOrder) String() string

type TeamOrderField

type TeamOrderField string
const (
	TeamOrderFieldSlug TeamOrderField = "SLUG"
)

func (TeamOrderField) IsValid

func (e TeamOrderField) IsValid() bool

func (TeamOrderField) MarshalGQL

func (e TeamOrderField) MarshalGQL(w io.Writer)

func (TeamOrderField) String

func (e TeamOrderField) String() string

func (*TeamOrderField) UnmarshalGQL

func (e *TeamOrderField) UnmarshalGQL(v interface{}) error

type TeamUpdatedActivityLogEntry

type TeamUpdatedActivityLogEntry struct {
	activitylog.GenericActivityLogEntry
	Data *TeamUpdatedActivityLogEntryData `json:"data"`
}

type TeamUpdatedActivityLogEntryData

type TeamUpdatedActivityLogEntryData struct {
	UpdatedFields []*TeamUpdatedActivityLogEntryDataUpdatedField `json:"updatedFields"`
}

type TeamUpdatedActivityLogEntryDataUpdatedField

type TeamUpdatedActivityLogEntryDataUpdatedField struct {
	Field    string  `json:"field"`
	OldValue *string `json:"oldValue"`
	NewValue *string `json:"newValue"`
}

type UpdateTeamEnvironmentInput

type UpdateTeamEnvironmentInput struct {
	Slug               slug.Slug `json:"slug"`
	EnvironmentName    string    `json:"environmentName"`
	SlackAlertsChannel *string   `json:"slackAlertsChannel"`
	GCPProjectID       *string   `json:"-"`
}

func (*UpdateTeamEnvironmentInput) Validate

func (i *UpdateTeamEnvironmentInput) Validate() error

type UpdateTeamEnvironmentPayload

type UpdateTeamEnvironmentPayload struct {
	Environment *TeamEnvironment `json:"environment"`
}

type UpdateTeamInput

type UpdateTeamInput struct {
	Slug         slug.Slug `json:"slug"`
	Purpose      *string   `json:"purpose" `
	SlackChannel *string   `json:"slackChannel"`
}

func (*UpdateTeamInput) Validate

func (i *UpdateTeamInput) Validate() error

type UpdateTeamPayload

type UpdateTeamPayload struct {
	Team *Team `json:"team"`
}

type UserTeamOrder

type UserTeamOrder struct {
	Field     UserTeamOrderField   `json:"field"`
	Direction model.OrderDirection `json:"direction"`
}

func (*UserTeamOrder) String

func (o *UserTeamOrder) String() string

type UserTeamOrderField

type UserTeamOrderField string
const (
	UserTeamOrderFieldTeamSlug UserTeamOrderField = "TEAM_SLUG"
)

func (UserTeamOrderField) IsValid

func (e UserTeamOrderField) IsValid() bool

func (UserTeamOrderField) MarshalGQL

func (e UserTeamOrderField) MarshalGQL(w io.Writer)

func (UserTeamOrderField) String

func (e UserTeamOrderField) String() string

func (*UserTeamOrderField) UnmarshalGQL

func (e *UserTeamOrderField) UnmarshalGQL(v interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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