Documentation
¶
Overview ¶
Package team manages teams, which are groups of users with shared privileges.
templ: version: v0.3.943
Index ¶
- Constants
- Variables
- func NewTeamCommand(apiClient *otfapi.Client) *cobra.Command
- type Client
- type CreateTeamOptions
- type CreateTokenOptions
- type ListOptions
- type Model
- type Options
- 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 organization.Name, opts CreateTeamOptions) (*Team, error)
- func (a *Service) CreateTeamToken(ctx context.Context, opts CreateTokenOptions) (*Token, []byte, error)
- func (a *Service) Delete(ctx context.Context, teamID resource.TfeID) error
- func (a *Service) DeleteTeamToken(ctx context.Context, teamID resource.TfeID) error
- func (a *Service) Get(ctx context.Context, organization organization.Name, name string) (*Team, error)
- func (a *Service) GetByID(ctx context.Context, teamID resource.TfeID) (*Team, error)
- func (a *Service) GetTeamByTokenID(ctx context.Context, tokenID resource.TfeID) (*Team, error)
- func (a *Service) GetTeamToken(ctx context.Context, teamID resource.TfeID) (*Token, error)
- func (a *Service) List(ctx context.Context, organization organization.Name) ([]*Team, error)
- func (f Service) NewTeamToken(opts CreateTokenOptions) (*Token, []byte, error)
- func (a *Service) Update(ctx context.Context, teamID resource.TfeID, opts UpdateTeamOptions) (*Team, error)
- type TFEOrganizationAccess
- type TFEOrganizationAccessOptions
- type TFETeam
- type TFETeamCreateOptions
- type TFETeamPermissions
- type TFETeamUpdateOptions
- type TFEUser
- type Team
- type Token
- type UpdateTeamOptions
Constants ¶
const TeamTokenKind resource.Kind = "tt"
Variables ¶
var ErrRemovingOwnersTeamNotPermitted = errors.New("the owners team cannot be deleted")
Functions ¶
Types ¶
type Client ¶
func (*Client) Create ¶ added in v0.2.2
func (c *Client) Create(ctx context.Context, organization organization.Name, 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 ListOptions ¶ added in v0.3.17
type ListOptions struct {
resource.PageOptions
Organization organization.Name `schema:"organization_name"`
}
type Model ¶ added in v0.3.17
type Model struct {
ID resource.TfeID `db:"team_id"`
Name string `db:"name"`
CreatedAt time.Time `db:"created_at"`
ManageWorkspaces bool `db:"permission_manage_workspaces"`
ManageVCS bool `db:"permission_manage_vcs"`
ManageModules bool `db:"permission_manage_modules"`
Organization organization.Name `db:"organization_name"`
SSOTeamID *string `db:"sso_team_id"`
Visibility string
ManagePolicies bool `db:"permission_manage_policies"`
ManagePolicyOverrides bool `db:"permission_manage_policy_overrides"`
ManageProviders bool `db:"permission_manage_providers"`
}
Order of fields must match order of columns
type OrganizationAccessOptions ¶
type OrganizationAccessOptions struct {
ManageWorkspaces *bool
ManageVCS *bool
ManageModules *bool
// 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 ¶ added in v0.2.2
type Service struct {
logr.Logger
*authz.Authorizer
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) AddHandlers ¶ added in v0.2.2
func (*Service) AfterCreateTeam ¶ added in v0.2.2
func (*Service) Create ¶ added in v0.2.2
func (a *Service) Create(ctx context.Context, organization organization.Name, opts CreateTeamOptions) (*Team, error)
func (*Service) CreateTeamToken ¶ added in v0.2.2
func (*Service) DeleteTeamToken ¶ added in v0.2.2
func (*Service) GetTeamByTokenID ¶ added in v0.2.2
func (*Service) GetTeamToken ¶ added in v0.2.2
func (Service) NewTeamToken ¶ added in v0.2.2
func (f Service) NewTeamToken(opts CreateTokenOptions) (*Token, []byte, error)
type TFEOrganizationAccess ¶ added in v0.3.17
type TFEOrganizationAccess struct {
ManagePolicies bool `jsonapi:"attribute" json:"manage-policies"`
ManagePolicyOverrides bool `jsonapi:"attribute" json:"manage-policy-overrides"`
ManageWorkspaces bool `jsonapi:"attribute" json:"manage-workspaces"`
ManageVCSSettings bool `jsonapi:"attribute" json:"manage-vcs-settings"`
ManageProviders bool `jsonapi:"attribute" json:"manage-providers"`
ManageModules bool `jsonapi:"attribute" json:"manage-modules"`
ManageRunTasks bool `jsonapi:"attribute" json:"manage-run-tasks"`
ManageProjects bool `jsonapi:"attribute" json:"manage-projects"`
ReadWorkspaces bool `jsonapi:"attribute" json:"read-workspaces"`
ReadProjects bool `jsonapi:"attribute" json:"read-projects"`
ManageMembership bool `jsonapi:"attribute" json:"manage-membership"`
}
TFEOrganizationAccess represents the team's permissions on its organization
type TFEOrganizationAccessOptions ¶ added in v0.3.17
type TFEOrganizationAccessOptions struct {
ManagePolicies *bool `json:"manage-policies,omitempty"`
ManagePolicyOverrides *bool `json:"manage-policy-overrides,omitempty"`
ManageWorkspaces *bool `json:"manage-workspaces,omitempty"`
ManageVCSSettings *bool `json:"manage-vcs-settings,omitempty"`
ManageProviders *bool `json:"manage-providers,omitempty"`
ManageModules *bool `json:"manage-modules,omitempty"`
ManageRunTasks *bool `json:"manage-run-tasks,omitempty"`
ManageProjects *bool `json:"manage-projects,omitempty"`
ReadWorkspaces *bool `json:"read-workspaces,omitempty"`
ReadProjects *bool `json:"read-projects,omitempty"`
ManageMembership *bool `json:"manage-membership,omitempty"`
}
OrganizationAccessOptions represents the organization access options of a team.
type TFETeam ¶ added in v0.3.17
type TFETeam struct {
ID resource.TfeID `jsonapi:"primary,teams"`
Name string `jsonapi:"attribute" json:"name"`
OrganizationAccess *TFEOrganizationAccess `jsonapi:"attribute" json:"organization-access"`
Visibility string `jsonapi:"attribute" json:"visibility"`
Permissions *TFETeamPermissions `jsonapi:"attribute" json:"permissions"`
UserCount int `jsonapi:"attribute" json:"users-count"`
SSOTeamID *string `jsonapi:"attribute" json:"sso-team-id"`
// Relations
Users []*TFEUser `jsonapi:"relationship" json:"users"`
}
TFETeam represents an otf team.
type TFETeamCreateOptions ¶ added in v0.3.17
type TFETeamCreateOptions struct {
// Type is a public field utilized by JSON:API to
// set the resource type via the field tag.
// It is not a user-defined value and does not need to be set.
// https://jsonapi.org/format/#crud-creating
Type string `jsonapi:"primary,teams"`
// Name of the team.
Name *string `jsonapi:"attribute" json:"name"`
// Optional: Unique Identifier to control team membership via SAML
SSOTeamID *string `jsonapi:"attribute" json:"sso-team-id,omitempty"`
// The team's organization access
OrganizationAccess *TFEOrganizationAccessOptions `jsonapi:"attribute" json:"organization-access,omitempty"`
// The team's visibility ("secret", "organization")
Visibility *string `jsonapi:"attribute" json:"visibility,omitempty"`
}
TFETeamCreateOptions represents the options for creating a team.
type TFETeamPermissions ¶ added in v0.3.17
type TFETeamPermissions struct {
CanDestroy bool `jsonapi:"attribute" json:"can-destroy"`
CanUpdateMembership bool `jsonapi:"attribute" json:"can-update-membership"`
}
TFETeamPermissions represents the current user's permissions on the team.
type TFETeamUpdateOptions ¶ added in v0.3.17
type TFETeamUpdateOptions struct {
// Type is a public field utilized by JSON:API to
// set the resource type via the field tag.
// It is not a user-defined value and does not need to be set.
// https://jsonapi.org/format/#crud-creating
Type string `jsonapi:"primary,teams"`
// Optional: New name for the team
Name *string `jsonapi:"attribute" json:"name,omitempty"`
// Optional: Unique Identifier to control team membership via SAML
SSOTeamID *string `jsonapi:"attribute" json:"sso-team-id,omitempty"`
// Optional: The team's organization access
OrganizationAccess *TFEOrganizationAccessOptions `jsonapi:"attribute" json:"organization-access,omitempty"`
// Optional: The team's visibility ("secret", "organization")
Visibility *string `jsonapi:"attribute" json:"visibility,omitempty"`
}
TFETeamUpdateOptions represents the options for updating a team.
type Team ¶
type Team struct {
ID resource.TfeID `jsonapi:"primary,teams" db:"team_id"`
Name string `jsonapi:"attribute" json:"name" db:"name"`
CreatedAt time.Time `jsonapi:"attribute" json:"created-at" db:"created_at"`
ManageWorkspaces bool `db:"permission_manage_workspaces"` // admin access on all workspaces
ManageVCS bool `db:"permission_manage_vcs"` // manage VCS providers
ManageModules bool `db:"permission_manage_modules"` // manage module registry
Organization organization.Name `jsonapi:"attribute" json:"organization" db:"organization_name"`
// TFE fields that OTF does not support but persists merely to pass the
// go-tfe integration tests
SSOTeamID *string `db:"sso_team_id"`
Visibility string
// TFE fields that OTF does not support but persists merely to pass the
// go-tfe integration tests
ManagePolicies bool `db:"permission_manage_policies"`
ManagePolicyOverrides bool `db:"permission_manage_policy_overrides"`
ManageProviders bool `db:"permission_manage_providers"`
}
Team is a group of users sharing a level of authorization.
func (*Team) Update ¶
func (t *Team) Update(opts UpdateTeamOptions) error
type Token ¶
type Token struct {
ID resource.TfeID `db:"team_token_id"`
CreatedAt time.Time `db:"created_at"`
// Token belongs to a team
TeamID resource.TfeID `db:"team_id"`
// Optional expiry.
Expiry *time.Time
// Description
//
// TODO: unused; create migration to remove from db.
Description *string `db:"description"`
}
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
}