Documentation
¶
Overview ¶
Package org provides shared logic for CircleCI organization operations.
Index ¶
- Variables
- func List(ctx context.Context, client *apiclient.Client) ([]apiclient.Collaboration, error)
- func ParseSlug(slug string) (vcs, orgName string, err error)
- func Require(ctx context.Context, client *apiclient.Client) ([]apiclient.Collaboration, error)
- func Select(ctx context.Context, client *apiclient.Client) (string, error)
- func ValidateSlug(collabs []apiclient.Collaboration, slug string) error
- type Info
Constants ¶
This section is empty.
Variables ¶
var ErrNotMember = errors.New("not a member of this organization")
ErrNotMember is returned by Details when orgID is not among the organizations the authenticated user belongs to.
Functions ¶
func Require ¶
Require fetches the user's organizations and returns an actionable error when the account has none. In interactive mode, offers to create a new CircleCI organization on the spot.
func Select ¶
Select fetches the user's organizations and presents an interactive picker. With exactly one org it is auto-selected; with multiple the user picks.
func ValidateSlug ¶
func ValidateSlug(collabs []apiclient.Collaboration, slug string) error
ValidateSlug checks that the given org slug is among the user's organizations.
Types ¶
type Info ¶ added in v1.16.0
type Info struct {
ID uuid.UUID
Name string
// VCS is the provider backing the org; empty for a standalone org.
VCS string
// Admin is nil when the server does not support the admin check.
Admin *bool
}
Info is what `circleci org get` reports about one organization.
func Details ¶ added in v1.16.0
Details gathers the organization's identity and the caller's admin status.
The identity comes from the caller's org list, and admin status from whether the org is among those the caller can manage (GET /api/v3/orgs with filter[can_manage]). A server without that filter — an older CircleCI server install — rejects it with 400 Bad Request; Admin is then left nil rather than failing the whole lookup. Any other error (5xx, network, cancellation) is returned.