Documentation ¶
Overview ¶
Package organization is responsible for OTF organizations
Index ¶
- Constants
- func NewCommand(client *otfapi.Client) *cobra.Command
- type CLI
- type Client
- type CreateOptions
- type CreateOrganizationTokenOptions
- type Entitlements
- type ListOptions
- type Options
- type Organization
- type OrganizationPage
- type OrganizationToken
- type Service
- func (s *Service) AddHandlers(r *mux.Router)
- func (s *Service) AfterCreateOrganization(hook func(context.Context, *Organization) error)
- func (s *Service) BeforeDeleteOrganization(hook func(context.Context, *Organization) error)
- func (s *Service) Create(ctx context.Context, opts CreateOptions) (*Organization, error)
- func (s *Service) CreateToken(ctx context.Context, opts CreateOrganizationTokenOptions) (*OrganizationToken, []byte, error)
- func (s *Service) Delete(ctx context.Context, name string) error
- func (s *Service) DeleteToken(ctx context.Context, organization string) error
- func (s *Service) Get(ctx context.Context, name string) (*Organization, error)
- func (s *Service) GetEntitlements(ctx context.Context, organization string) (Entitlements, error)
- func (s *Service) GetOrganizationToken(ctx context.Context, organization string) (*OrganizationToken, error)
- func (s *Service) List(ctx context.Context, opts ListOptions) (*resource.Page[*Organization], error)
- func (s *Service) ListTokens(ctx context.Context, organization string) ([]*OrganizationToken, error)
- func (s *Service) Update(ctx context.Context, name string, opts UpdateOptions) (*Organization, error)
- func (s *Service) WatchOrganizations(ctx context.Context) (<-chan pubsub.Event[*Organization], func())
- type UpdateOptions
Constants ¶
const ( DefaultSessionTimeout = 20160 DefaultSessionExpiration = 20160 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
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 resource.ID 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 resource.ID `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 (*Organization) Update ¶
func (org *Organization) Update(opts UpdateOptions) error
type OrganizationPage ¶
OrganizationPage contains data shared by all organization-based pages.
type OrganizationToken ¶ added in v0.2.0
type OrganizationToken struct { resource.ID 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) CanAccess ¶ added in v0.3.6
func (u *OrganizationToken) CanAccess(action authz.Action, req *authz.AccessRequest) bool
func (*OrganizationToken) Organizations ¶ added in v0.2.0
func (u *OrganizationToken) Organizations() []string
type Service ¶
type Service struct { RestrictOrganizationCreation bool *authz.Authorizer logr.Logger // contains filtered or unexported fields }
func NewService ¶
func (*Service) AddHandlers ¶ added in v0.2.2
func (*Service) AfterCreateOrganization ¶ added in v0.1.8
func (s *Service) AfterCreateOrganization(hook func(context.Context, *Organization) error)
func (*Service) BeforeDeleteOrganization ¶ added in v0.1.8
func (s *Service) BeforeDeleteOrganization(hook func(context.Context, *Organization) error)
func (*Service) Create ¶ added in v0.2.2
func (s *Service) Create(ctx context.Context, opts CreateOptions) (*Organization, error)
Create creates an organization. Only users can create organizations, or, if RestrictOrganizationCreation is true, then only the site admin can create organizations. Creating an organization automatically creates an owners team and adds creator as an owner.
func (*Service) CreateToken ¶ added in v0.2.2
func (s *Service) CreateToken(ctx context.Context, opts CreateOrganizationTokenOptions) (*OrganizationToken, []byte, error)
CreateToken creates an organization token. If an organization token already exists it is replaced.
func (*Service) DeleteToken ¶ added in v0.2.2
func (*Service) GetEntitlements ¶
func (*Service) GetOrganizationToken ¶ added in v0.2.0
func (*Service) List ¶ added in v0.2.2
func (s *Service) List(ctx context.Context, opts ListOptions) (*resource.Page[*Organization], error)
List organizations. If the subject lacks the ListOrganizationsAction permission then its organization memberships are listed instead.
func (*Service) ListTokens ¶ added in v0.2.2
func (*Service) Update ¶ added in v0.2.2
func (s *Service) Update(ctx context.Context, name string, opts UpdateOptions) (*Organization, error)
func (*Service) WatchOrganizations ¶ added in v0.2.0
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.