Documentation
¶
Overview ¶
Package team manages teams, which are groups of users with shared privileges.
Index ¶
- Constants
- Variables
- func NewTeamCommand(apiClient *otfapi.Client) *cobra.Command
- type Client
- type CreateTeamOptions
- type CreateTokenOptions
- type Options
- type OrganizationAccess
- type OrganizationAccessOptions
- type Service
- func (a *Service) AddHandlers(r *mux.Router)
- func (a *Service) AfterCreateTeam(hook func(context.Context, *Team) error)
- func (a *Service) Create(ctx context.Context, organization string, opts CreateTeamOptions) (*Team, error)
- func (a *Service) CreateTeamToken(ctx context.Context, opts CreateTokenOptions) (*Token, []byte, error)
- func (a *Service) Delete(ctx context.Context, teamID string) error
- func (a *Service) DeleteTeamToken(ctx context.Context, teamID string) error
- func (a *Service) Get(ctx context.Context, organization, name string) (*Team, error)
- func (a *Service) GetByID(ctx context.Context, teamID string) (*Team, error)
- func (a *Service) GetTeamByTokenID(ctx context.Context, tokenID string) (*Team, error)
- func (a *Service) GetTeamToken(ctx context.Context, teamID string) (*Token, error)
- func (a *Service) List(ctx context.Context, organization string) ([]*Team, error)
- func (f Service) NewTeamToken(opts CreateTokenOptions) (*Token, []byte, error)
- func (a *Service) Update(ctx context.Context, teamID string, opts UpdateTeamOptions) (*Team, error)
- type Team
- func (t *Team) CanAccessOrganization(action rbac.Action, org string) bool
- func (t *Team) CanAccessSite(action rbac.Action) bool
- func (t *Team) CanAccessTeam(action rbac.Action, id string) bool
- func (t *Team) CanAccessWorkspace(action rbac.Action, policy internal.WorkspacePolicy) bool
- func (t *Team) IsOwner(organization string) bool
- func (t *Team) IsOwners() bool
- func (t *Team) IsSiteAdmin() bool
- func (t *Team) OrganizationAccess() OrganizationAccess
- func (t *Team) Organizations() []string
- func (t *Team) String() string
- func (t *Team) Update(opts UpdateTeamOptions) error
- type TeamRow
- type Token
- type UpdateTeamOptions
Constants ¶
View Source
const TeamTokenKind tokens.Kind = "team_token"
Variables ¶
View Source
var ErrRemovingOwnersTeamNotPermitted = errors.New("the owners team cannot be deleted")
Functions ¶
Types ¶
type Client ¶
func (*Client) Create ¶
func (c *Client) Create(ctx context.Context, organization string, opts CreateTeamOptions) (*Team, error)
Create creates a team via HTTP/JSONAPI.
type CreateTeamOptions ¶
type CreateTeamOptions struct {
// Name of team to create
Name *string `json:"name" schema:"name,required"`
OrganizationAccessOptions
// TFE fields that OTF does not support but persists merely to pass the
// go-tfe integration tests
SSOTeamID *string
Visibility *string
}
type CreateTokenOptions ¶
CreateTokenOptions are options for creating an team token via the service endpoint
type OrganizationAccess ¶
type OrganizationAccess struct {
ManageWorkspaces bool // admin access on all workspaces
ManageVCS bool // manage VCS providers
ManageModules bool // manage module registry
// TFE fields that OTF does not support but persists merely to pass the
// go-tfe integration tests
ManageProviders bool
ManagePolicies bool
ManagePolicyOverrides bool
}
OrganizationAccess defines a team's organization access.
type OrganizationAccessOptions ¶
type OrganizationAccessOptions struct {
ManageWorkspaces *bool `schema:"manage_workspaces"`
ManageVCS *bool `schema:"manage_vcs"`
ManageModules *bool `schema:"manage_modules"`
// TFE fields that OTF does not support but persists merely to pass the
// go-tfe integration tests
ManageProviders *bool
ManagePolicies *bool
ManagePolicyOverrides *bool
}
OrganizationAccessOptions defines access to be granted upon team creation or to grant/rescind to/from an existing team.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) AddHandlers ¶
func (*Service) AfterCreateTeam ¶
func (*Service) CreateTeamToken ¶
func (*Service) DeleteTeamToken ¶
func (*Service) GetTeamByTokenID ¶
func (*Service) GetTeamToken ¶
func (Service) NewTeamToken ¶
func (f Service) NewTeamToken(opts CreateTokenOptions) (*Token, []byte, error)
type Team ¶
type Team struct {
ID string `jsonapi:"primary,teams"`
CreatedAt time.Time `jsonapi:"attribute" json:"created-at"`
Name string `jsonapi:"attribute" json:"name"`
Organization string `jsonapi:"attribute" json:"organization"`
Access OrganizationAccess
// TFE fields that OTF does not support but persists merely to pass the
// go-tfe integration tests
Visibility string
SSOTeamID *string
}
Team is a group of users sharing a level of authorization.
func (*Team) CanAccessOrganization ¶
func (*Team) CanAccessWorkspace ¶
func (*Team) IsSiteAdmin ¶
func (*Team) OrganizationAccess ¶
func (t *Team) OrganizationAccess() OrganizationAccess
func (*Team) Organizations ¶
func (*Team) Update ¶
func (t *Team) Update(opts UpdateTeamOptions) error
type TeamRow ¶
type TeamRow struct {
TeamID pgtype.Text `json:"team_id"`
Name pgtype.Text `json:"name"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
PermissionManageWorkspaces pgtype.Bool `json:"permission_manage_workspaces"`
PermissionManageVCS pgtype.Bool `json:"permission_manage_vcs"`
PermissionManageModules pgtype.Bool `json:"permission_manage_modules"`
OrganizationName pgtype.Text `json:"organization_name"`
SSOTeamID pgtype.Text `json:"sso_team_id"`
Visibility pgtype.Text `json:"visibility"`
PermissionManagePolicies pgtype.Bool `json:"permission_manage_policies"`
PermissionManagePolicyOverrides pgtype.Bool `json:"permission_manage_policy_overrides"`
PermissionManageProviders pgtype.Bool `json:"permission_manage_providers"`
}
TeamRow represents the result of a database query for a team.
type Token ¶
type Token struct {
ID string
CreatedAt time.Time
// Token belongs to a team
TeamID string
// Optional expiry.
Expiry *time.Time
}
Token provides information about an API token for a team.
type UpdateTeamOptions ¶
type UpdateTeamOptions struct {
Name *string
OrganizationAccessOptions
// TFE fields that OTF does not support but persists merely to pass the
// go-tfe integration tests
SSOTeamID *string
Visibility *string
}
Click to show internal directories.
Click to hide internal directories.