organizations

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*up.Config
}

Client is an organizations client.

func NewClient

func NewClient(cfg *up.Config) *Client

NewClient builds an organizations client from the passed config.

func (*Client) Create

func (c *Client) Create(ctx context.Context, params *OrganizationCreateParameters) error

Create an organization on Upbound.

func (*Client) CreateInvite

func (c *Client) CreateInvite(ctx context.Context, orgID uint, params *OrganizationInviteCreateParameters) error

CreateInvite creates an invite for the organization on Upbound.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, id uint) error

Delete an organization on Upbound.

func (*Client) DeleteInvite

func (c *Client) DeleteInvite(ctx context.Context, orgID uint, inviteID uint) error

DeleteInvite deletes an invite for the organization on Upbound.

func (*Client) Get

func (c *Client) Get(ctx context.Context, id uint) (*Organization, error)

Get an organization on Upbound.

func (*Client) GetOrgID

func (c *Client) GetOrgID(ctx context.Context, name string) (uint, error)

GetOrgID returns the ID of an org given its name. There is a requirement that orgs are uniquely named, so we know there is at most one org with the given name.

func (*Client) List

func (c *Client) List(ctx context.Context) ([]Organization, error)

List all organizations for the authenticated user on Upbound.

func (*Client) ListInvites

func (c *Client) ListInvites(ctx context.Context, orgID uint) ([]Invite, error)

ListInvites list all invites for the organization on Upbound.

func (*Client) ListMembers

func (c *Client) ListMembers(ctx context.Context, orgID uint) ([]Member, error)

ListMembers list all members for the organization on Upbound.

func (*Client) ListRobots

func (c *Client) ListRobots(ctx context.Context, id uint) ([]Robot, error)

ListRobots list all robots the user can access in the organization on Upbound. TODO(hasheddan): move this to robots client when API is updated.

func (*Client) RemoveMember

func (c *Client) RemoveMember(ctx context.Context, orgID uint, userID uint) error

RemoveMember removes a member for the organization on Upbound.

type Invite

type Invite struct {
	ID         uint                        `json:"id"`
	Email      string                      `json:"email"`
	Permission OrganizationPermissionGroup `json:"permission"`
	CreatedAt  string                      `json:"createdAt"`
}

Invite is a pending organization member.

type Member

type Member struct {
	Permission OrganizationPermissionGroup `json:"permission"`
	User       User                        `json:"user"`
}

Member is a member of an organization.

type Organization

type Organization struct {
	ID                   uint                        `json:"id"`
	Name                 string                      `json:"name"`
	DisplayName          string                      `json:"displayName"`
	CreatorID            uint                        `json:"creatorId"`
	Role                 OrganizationPermissionGroup `json:"role"`
	ReservedEnvironments int                         `json:"reservedEnvironments"`
}

Organization is an organization on Upbound.

type OrganizationCreateParameters

type OrganizationCreateParameters struct {
	Name        string `json:"name"`
	DisplayName string `json:"displayName"`
}

OrganizationCreateParameters are the parameters for creating an organization.

type OrganizationInviteCreateParameters

type OrganizationInviteCreateParameters struct {
	Email      string                      `json:"email"`
	Permission OrganizationPermissionGroup `json:"organizationPermission"`
}

OrganizationInviteCreateParameters are the parameters for creating a user invite to an organization.

type OrganizationPermissionGroup

type OrganizationPermissionGroup string

OrganizationPermissionGroup is the type of permission a user has in the organization.

const (
	// OrganizationMember denotes basic permission on an organization.
	OrganizationMember OrganizationPermissionGroup = "member"
	// OrganizationOwner denotes full access permission on an organization.
	OrganizationOwner OrganizationPermissionGroup = "owner"
)

type Robot

type Robot struct {
	ID          uuid.UUID   `json:"id"`
	Name        string      `json:"name"`
	Description string      `json:"description"`
	TeamIDs     []uuid.UUID `json:"teamIDs"`
	TokenIDs    []uuid.UUID `json:"tokenIDs"`
	CreatedAt   time.Time   `json:"createdAt"`
}

Robot is a robot account on Upbound.

type User

type User struct {
	ID       uint   `json:"id"`
	Name     string `json:"name"`
	Email    string `json:"email"`
	Username string `json:"username"`
}

User is a user on Upbound.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL