Documentation
¶
Overview ¶
Package organization is responsible for OTF organizations
Index ¶
- Constants
- func NewCommand(client *otfapi.Client) *cobra.Command
- func NewService(opts Options) *service
- type Authorizer
- type CLI
- type Client
- type CreateOptions
- type CreateOrganizationTokenOptions
- type Entitlements
- type ListOptions
- type Options
- type Organization
- type OrganizationPage
- type OrganizationService
- type OrganizationToken
- func (u *OrganizationToken) CanAccessOrganization(action rbac.Action, org string) bool
- func (u *OrganizationToken) CanAccessSite(action rbac.Action) bool
- func (u *OrganizationToken) CanAccessTeam(rbac.Action, string) bool
- func (u *OrganizationToken) CanAccessWorkspace(action rbac.Action, policy internal.WorkspacePolicy) bool
- func (u *OrganizationToken) IsOwner(organization string) bool
- func (u *OrganizationToken) IsSiteAdmin() bool
- func (u *OrganizationToken) Organizations() []string
- func (u *OrganizationToken) String() string
- type Service
- type UpdateOptions
Constants ¶
const ( DefaultSessionTimeout = 20160 DefaultSessionExpiration = 20160 )
const OrganizationTokenKind tokens.Kind = "organization_token"
Variables ¶
This section is empty.
Functions ¶
func NewService ¶
func NewService(opts Options) *service
Types ¶
type Authorizer ¶
Authorizer authorizes access to an organization
type Client ¶
func (*Client) CreateOrganization ¶ added in v0.1.0
func (c *Client) CreateOrganization(ctx context.Context, options CreateOptions) (*Organization, error)
CreateOrganization creates a new organization with the given options.
type CreateOptions ¶ added in v0.1.8
type CreateOptions struct {
Name *string
// TFE fields that OTF does not support but persists merely to pass the
// go-tfe integration tests
Email *string
CollaboratorAuthPolicy *string
CostEstimationEnabled *bool
SessionRemember *int
SessionTimeout *int
AllowForceDeleteWorkspaces *bool
}
CreateOptions represents the options for creating an organization. See types.CreateOptions for more details.
type CreateOrganizationTokenOptions ¶ added in v0.2.0
type CreateOrganizationTokenOptions struct {
Organization string `schema:"organization_name,required"`
Expiry *time.Time
}
CreateOrganizationTokenOptions are options for creating an organization token via the service endpoint
type Entitlements ¶
type Entitlements struct {
ID string
Agents bool
AuditLogging bool
CostEstimation bool
Operations bool
PrivateModuleRegistry bool
SSO bool
Sentinel bool
StateStorage bool
Teams bool
VCSIntegrations bool
}
OTF is free and therefore the user is entitled to all currently supported services.
type ListOptions ¶ added in v0.0.51
type ListOptions struct {
resource.PageOptions
}
ListOptions represents the options for listing organizations.
type Organization ¶
type Organization struct {
ID string `jsonapi:"primary,organizations"`
CreatedAt time.Time `jsonapi:"attribute" json:"created-at"`
UpdatedAt time.Time `jsonapi:"attribute" json:"updated-at"`
Name string `jsonapi:"attribute" json:"name"`
// TFE fields that OTF does not support but persists merely to pass the
// go-tfe integration tests
Email *string
CollaboratorAuthPolicy *string
SessionRemember *int
SessionTimeout *int
AllowForceDeleteWorkspaces bool
CostEstimationEnabled bool
}
Organization is an OTF organization, comprising workspaces, users, etc.
func NewOrganization ¶ added in v0.1.0
func NewOrganization(opts CreateOptions) (*Organization, error)
func NewTestOrganization ¶
func NewTestOrganization(t *testing.T) *Organization
func (*Organization) String ¶
func (org *Organization) String() string
func (*Organization) Update ¶
func (org *Organization) Update(opts UpdateOptions) error
type OrganizationPage ¶
OrganizationPage contains data shared by all organization-based pages.
type OrganizationService ¶
type OrganizationService = Service
type OrganizationToken ¶ added in v0.2.0
type OrganizationToken struct {
ID string
CreatedAt time.Time
// Token belongs to an organization
Organization string
// Optional expiry.
Expiry *time.Time
}
OrganizationToken provides information about an API token for an organization
func (*OrganizationToken) CanAccessOrganization ¶ added in v0.2.0
func (u *OrganizationToken) CanAccessOrganization(action rbac.Action, org string) bool
func (*OrganizationToken) CanAccessSite ¶ added in v0.2.0
func (u *OrganizationToken) CanAccessSite(action rbac.Action) bool
func (*OrganizationToken) CanAccessTeam ¶ added in v0.2.0
func (u *OrganizationToken) CanAccessTeam(rbac.Action, string) bool
func (*OrganizationToken) CanAccessWorkspace ¶ added in v0.2.0
func (u *OrganizationToken) CanAccessWorkspace(action rbac.Action, policy internal.WorkspacePolicy) bool
func (*OrganizationToken) IsOwner ¶ added in v0.2.0
func (u *OrganizationToken) IsOwner(organization string) bool
func (*OrganizationToken) IsSiteAdmin ¶ added in v0.2.0
func (u *OrganizationToken) IsSiteAdmin() bool
func (*OrganizationToken) Organizations ¶ added in v0.2.0
func (u *OrganizationToken) Organizations() []string
func (*OrganizationToken) String ¶ added in v0.2.0
func (u *OrganizationToken) String() string
type Service ¶
type Service interface {
CreateOrganization(ctx context.Context, opts CreateOptions) (*Organization, error)
UpdateOrganization(ctx context.Context, name string, opts UpdateOptions) (*Organization, error)
GetOrganization(ctx context.Context, name string) (*Organization, error)
ListOrganizations(ctx context.Context, opts ListOptions) (*resource.Page[*Organization], error)
DeleteOrganization(ctx context.Context, name string) error
GetEntitlements(ctx context.Context, organization string) (Entitlements, error)
AfterCreateOrganization(l hooks.Listener[*Organization])
BeforeDeleteOrganization(l hooks.Listener[*Organization])
// organization tokens
CreateOrganizationToken(ctx context.Context, opts CreateOrganizationTokenOptions) (*OrganizationToken, []byte, error)
// GetOrganizationToken gets the organization token. If a token does not
// exist, then nil is returned without an error.
GetOrganizationToken(ctx context.Context, organization string) (*OrganizationToken, error)
DeleteOrganizationToken(ctx context.Context, organization string) error
WatchOrganizations(context.Context) (<-chan pubsub.Event[*Organization], func())
// contains filtered or unexported methods
}
type UpdateOptions ¶ added in v0.1.8
type UpdateOptions struct {
Name *string
SessionRemember *int
SessionTimeout *int
// TFE fields that OTF does not support but persists merely to pass the
// go-tfe integration tests
Email *string
CollaboratorAuthPolicy *string
CostEstimationEnabled *bool
AllowForceDeleteWorkspaces *bool
}
UpdateOptions represents the options for updating an organization.