Documentation
¶
Overview ¶
Package api provides the daemon API.
Index ¶
- type Client
- type CredentialsClient
- func (c *CredentialsClient) Create(ctx context.Context, cred *apitypes.Credential, progress *ProgressFunc) (*apitypes.CredentialEnvelope, error)
- func (c *CredentialsClient) Get(ctx context.Context, path string) ([]apitypes.CredentialEnvelope, error)
- func (c *CredentialsClient) Search(ctx context.Context, pathexp string) ([]apitypes.CredentialEnvelope, error)
- type EnvironmentResult
- type EnvironmentsClient
- type Event
- type InviteResult
- type InvitesClient
- func (i *InvitesClient) Accept(ctx context.Context, org, email, code string) error
- func (i *InvitesClient) Approve(ctx context.Context, inviteID identity.ID, output *ProgressFunc) error
- func (i *InvitesClient) Associate(ctx context.Context, org, email, code string) (*InviteResult, error)
- func (i *InvitesClient) List(ctx context.Context, orgID *identity.ID, states []string) ([]InviteResult, error)
- func (i *InvitesClient) Send(ctx context.Context, email string, orgID, inviterID identity.ID, ...) error
- type KeypairResult
- type KeypairsClient
- type MachinesClient
- func (m *MachinesClient) Create(ctx context.Context, orgID, teamID *identity.ID, name string, ...) (*apitypes.MachineSegment, *base64.Value, error)
- func (m *MachinesClient) Destroy(ctx context.Context, machineID *identity.ID) error
- func (m *MachinesClient) Get(ctx context.Context, machineID *identity.ID) (*apitypes.MachineSegment, error)
- func (m *MachinesClient) List(ctx context.Context, orgID *identity.ID, state *string, name *string, ...) ([]*apitypes.MachineSegment, error)
- type MembershipResult
- type MembershipsClient
- type OrgResult
- type OrgTreeSegment
- type OrgsClient
- func (o *OrgsClient) Create(ctx context.Context, name string) (*OrgResult, error)
- func (o *OrgsClient) GetByName(ctx context.Context, name string) (*OrgResult, error)
- func (o *OrgsClient) GetTree(ctx context.Context, orgID identity.ID) ([]OrgTreeSegment, error)
- func (o *OrgsClient) List(ctx context.Context) ([]OrgResult, error)
- func (o *OrgsClient) RemoveMember(ctx context.Context, orgID identity.ID, userID identity.ID) error
- type PoliciesClient
- func (p *PoliciesClient) Attach(ctx context.Context, org, policy, team *identity.ID) error
- func (p *PoliciesClient) AttachmentsList(ctx context.Context, orgID, ownerID, policyID *identity.ID) ([]PolicyAttachmentResult, error)
- func (p *PoliciesClient) Create(ctx context.Context, policy *primitive.Policy) (*PoliciesResult, error)
- func (p *PoliciesClient) Detach(ctx context.Context, attachmentID *identity.ID) error
- func (p *PoliciesClient) List(ctx context.Context, orgID *identity.ID, name string) ([]PoliciesResult, error)
- type PoliciesResult
- type PolicyAttachmentResult
- type ProfilesClient
- type ProgressFunc
- type ProjectResult
- type ProjectTreeSegment
- type ProjectsClient
- func (p *ProjectsClient) Create(ctx context.Context, org *identity.ID, name string) (*ProjectResult, error)
- func (p *ProjectsClient) GetTree(ctx context.Context, orgID *identity.ID) ([]ProjectTreeSegment, error)
- func (p *ProjectsClient) List(ctx context.Context, orgIDs *[]*identity.ID, names *[]string) ([]ProjectResult, error)
- type ServiceResult
- type ServicesClient
- type Session
- type SessionClient
- func (s *SessionClient) Get(ctx context.Context) (*apitypes.SessionStatus, error)
- func (s *SessionClient) Logout(ctx context.Context) error
- func (s *SessionClient) MachineLogin(ctx context.Context, tokenID, tokenSecret string) error
- func (s *SessionClient) UserLogin(ctx context.Context, email, passphrase string) error
- func (s *SessionClient) Who(ctx context.Context) (*Session, error)
- type TeamResult
- type TeamsClient
- func (t *TeamsClient) Create(ctx context.Context, orgID *identity.ID, name string, ...) (*apitypes.Team, error)
- func (t *TeamsClient) GetByName(ctx context.Context, orgID *identity.ID, name string) ([]TeamResult, error)
- func (t *TeamsClient) GetByOrg(ctx context.Context, orgID *identity.ID) ([]TeamResult, error)
- func (t *TeamsClient) List(ctx context.Context, orgID *identity.ID, name string, ...) ([]TeamResult, error)
- type UserResult
- type UsersClient
- type VersionClient
- type WorklogClient
- func (w *WorklogClient) Get(ctx context.Context, orgID *identity.ID, ident *apitypes.WorklogID) (*apitypes.WorklogItem, error)
- func (w *WorklogClient) List(ctx context.Context, orgID *identity.ID) ([]apitypes.WorklogItem, error)
- func (w *WorklogClient) Resolve(ctx context.Context, orgID *identity.ID, ident *apitypes.WorklogID) (*apitypes.WorklogResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Orgs *OrgsClient Users *UsersClient Machines *MachinesClient Profiles *ProfilesClient Teams *TeamsClient Memberships *MembershipsClient Invites *InvitesClient Keypairs *KeypairsClient Session *SessionClient Services *ServicesClient Policies *PoliciesClient Environments *EnvironmentsClient Projects *ProjectsClient Credentials *CredentialsClient Worklog *WorklogClient Version *VersionClient // contains filtered or unexported fields }
Client exposes the daemon API.
func (*Client) Do ¶
func (c *Client) Do(ctx context.Context, r *http.Request, v interface{}, reqID *string, progress *ProgressFunc) (*http.Response, error)
Do executes an http.Request, populating v with the JSON response on success.
If the request errors with a JSON formatted response body, it will be unmarshaled into the returned error.
type CredentialsClient ¶
type CredentialsClient struct {
// contains filtered or unexported fields
}
CredentialsClient provides access to unencrypted credentials for viewing, and encrypts credentials when setting.
func (*CredentialsClient) Create ¶ added in v0.8.0
func (c *CredentialsClient) Create(ctx context.Context, cred *apitypes.Credential, progress *ProgressFunc) (*apitypes.CredentialEnvelope, error)
Create creates the given credential
func (*CredentialsClient) Get ¶
func (c *CredentialsClient) Get(ctx context.Context, path string) ([]apitypes.CredentialEnvelope, error)
Get returns all credentials at the given path.
func (*CredentialsClient) Search ¶ added in v0.13.0
func (c *CredentialsClient) Search(ctx context.Context, pathexp string) ([]apitypes.CredentialEnvelope, error)
Search returns all credentials at the given pathexp.
type EnvironmentResult ¶
type EnvironmentResult struct { ID *identity.ID `json:"id"` Version uint8 `json:"version"` Body *primitive.Environment `json:"body"` }
EnvironmentResult is the payload returned for a env object
type EnvironmentsClient ¶
type EnvironmentsClient struct {
// contains filtered or unexported fields
}
EnvironmentsClient makes proxied requests to the registry's envs endpoints
func (*EnvironmentsClient) Create ¶
func (e *EnvironmentsClient) Create(ctx context.Context, orgID, projectID *identity.ID, name string) error
Create generates a new env object for an org/project ID
func (*EnvironmentsClient) List ¶
func (e *EnvironmentsClient) List(ctx context.Context, orgIDs, projectIDs *[]*identity.ID, names *[]string) ([]EnvironmentResult, error)
List retrieves relevant envs by name and/or orgID and/or projectID
type Event ¶
type Event struct { ID string `json:"id"` MessageType string Message string `json:"message"` Completed int `json:"completed"` Total int `json:"total"` }
Event contains the properties of a server sent event
type InviteResult ¶
type InviteResult struct { ID *identity.ID `json:"id"` Version uint8 `json:"version"` Body *primitive.OrgInvite `json:"body"` }
InviteResult is the payload returned for a team object
type InvitesClient ¶
type InvitesClient struct {
// contains filtered or unexported fields
}
InvitesClient makes proxied requests to the registry's invites endpoints
func (*InvitesClient) Accept ¶
func (i *InvitesClient) Accept(ctx context.Context, org, email, code string) error
Accept executes the accept invite request
func (*InvitesClient) Approve ¶
func (i *InvitesClient) Approve(ctx context.Context, inviteID identity.ID, output *ProgressFunc) error
Approve executes the approve invite request
func (*InvitesClient) Associate ¶
func (i *InvitesClient) Associate(ctx context.Context, org, email, code string) (*InviteResult, error)
Associate executes the associate invite request
func (*InvitesClient) List ¶
func (i *InvitesClient) List(ctx context.Context, orgID *identity.ID, states []string) ([]InviteResult, error)
List all invites for a given org
type KeypairResult ¶
type KeypairResult struct { PublicKey *struct { ID *identity.ID `json:"id"` Body *primitive.PublicKey `json:"body"` } `json:"public_key"` PrivateKey *struct { ID *identity.ID `json:"id"` Body *primitive.PublicKey `json:"body"` } `json:"private_key"` Claims []struct { ID *identity.ID `json:"id"` Body *primitive.Claim `json:"claims"` } }
KeypairResult is the payload returned for a keypair object
func (*KeypairResult) Revoked ¶ added in v0.18.0
func (k *KeypairResult) Revoked() bool
Revoked returns a bool indicating if any revocation claims exist against this KeypairResult's keypair.
type KeypairsClient ¶
type KeypairsClient struct {
// contains filtered or unexported fields
}
KeypairsClient makes proxied requests to the registry's keypairs endpoints
func (*KeypairsClient) Generate ¶
func (k *KeypairsClient) Generate(ctx context.Context, orgID *identity.ID, output *ProgressFunc) error
Generate generates new keypairs for the user in the given org.
func (*KeypairsClient) List ¶
func (k *KeypairsClient) List(ctx context.Context, orgID *identity.ID) ([]KeypairResult, error)
List retrieves relevant keypairs by orgID
type MachinesClient ¶ added in v0.15.0
type MachinesClient struct {
// contains filtered or unexported fields
}
MachinesClient makes requests to the Daemon on behalf of the user to manipulate Machine resources.
func (*MachinesClient) Create ¶ added in v0.15.0
func (m *MachinesClient) Create(ctx context.Context, orgID, teamID *identity.ID, name string, output *ProgressFunc) (*apitypes.MachineSegment, *base64.Value, error)
Create a new machine in the given org
func (*MachinesClient) Get ¶ added in v0.15.0
func (m *MachinesClient) Get(ctx context.Context, machineID *identity.ID) (*apitypes.MachineSegment, error)
Get machine by ID
type MembershipResult ¶
type MembershipResult struct { ID *identity.ID Version uint8 Body *primitive.Membership }
MembershipResult is the payload returned for team membership association.
type MembershipsClient ¶
type MembershipsClient struct {
// contains filtered or unexported fields
}
MembershipsClient makes proxied requests to the registry's team memberships endpoints.
func (*MembershipsClient) List ¶
func (m *MembershipsClient) List(ctx context.Context, org, user, team *identity.ID) ([]MembershipResult, error)
List returns all team membership associations for the given user id within the given org id.
type OrgResult ¶
type OrgResult struct { ID *identity.ID `json:"id"` Version uint8 `json:"version"` Body *primitive.Org `json:"body"` }
OrgResult is the payload returned for an org object
type OrgTreeSegment ¶ added in v0.15.0
type OrgTreeSegment struct { Org *primitive.Org `json:"org"` Policies []*primitive.Policy `json:"policies"` Profiles []*apitypes.Profile `json:"profiles"` Teams []*struct { Team *apitypes.Team `json:"team"` Memberships *[]*apitypes.Membership `json:"memberships"` PolicyAttachments *[]*PolicyAttachmentResult `json:"policy_attachments"` } `json:"teams"` }
OrgTreeSegment is the payload returns for an org tree
type OrgsClient ¶
type OrgsClient struct {
// contains filtered or unexported fields
}
OrgsClient makes proxied requests to the registry's orgs endpoints
func (*OrgsClient) Create ¶
Create creates a new org with the given name. It returns the newly-created org.
func (*OrgsClient) GetTree ¶ added in v0.15.0
func (o *OrgsClient) GetTree(ctx context.Context, orgID identity.ID) ([]OrgTreeSegment, error)
GetTree returns an org tree
func (*OrgsClient) List ¶
func (o *OrgsClient) List(ctx context.Context) ([]OrgResult, error)
List returns all organizations that the signed-in user has access to
func (*OrgsClient) RemoveMember ¶ added in v0.12.0
RemoveMember removes a user from an org
type PoliciesClient ¶
type PoliciesClient struct {
// contains filtered or unexported fields
}
PoliciesClient makes proxied requests to the registry's policies endpoints
func (*PoliciesClient) AttachmentsList ¶
func (p *PoliciesClient) AttachmentsList(ctx context.Context, orgID, ownerID, policyID *identity.ID) ([]PolicyAttachmentResult, error)
AttachmentsList retrieves all policy attachments for an org
func (*PoliciesClient) Create ¶ added in v0.8.0
func (p *PoliciesClient) Create(ctx context.Context, policy *primitive.Policy) (*PoliciesResult, error)
Create creates a new policy
func (*PoliciesClient) List ¶
func (p *PoliciesClient) List(ctx context.Context, orgID *identity.ID, name string) ([]PoliciesResult, error)
List retrieves relevant policiies by orgID and/or name
type PoliciesResult ¶
type PoliciesResult struct { ID *identity.ID `json:"id"` Version uint8 `json:"version"` Body *primitive.Policy `json:"body"` }
PoliciesResult is the payload returned for a policy object
type PolicyAttachmentResult ¶
type PolicyAttachmentResult struct { ID *identity.ID `json:"id"` Version uint8 `json:"version"` Body *primitive.PolicyAttachment `json:"body"` }
PolicyAttachmentResult is the payload returned for a policy_attachment object
type ProfilesClient ¶
type ProfilesClient struct {
// contains filtered or unexported fields
}
ProfilesClient makes proxied requests to the registry's profiles endpoints
func (*ProfilesClient) ListByID ¶
func (p *ProfilesClient) ListByID(ctx context.Context, userIDs []identity.ID) (*[]apitypes.Profile, error)
ListByID returns profiles looked up by User ID
func (*ProfilesClient) ListByName ¶
ListByName returns profiles looked up by username
type ProgressFunc ¶
ProgressFunc is used to output events
type ProjectResult ¶
type ProjectResult struct { ID *identity.ID `json:"id"` Version uint8 `json:"version"` Body *primitive.Project `json:"body"` }
ProjectResult is the payload returned for a project object
type ProjectTreeSegment ¶ added in v0.19.0
type ProjectTreeSegment struct { Org *OrgResult `json:"org"` Envs []*apitypes.Environment `json:"envs"` Services []*apitypes.Service `json:"services"` Projects []*ProjectResult `json:"projects"` Profiles []*apitypes.Profile `json:"profiles"` }
ProjectTreeSegment is the payload returned for a project tree
type ProjectsClient ¶
type ProjectsClient struct {
// contains filtered or unexported fields
}
ProjectsClient makes proxied requests to the registry's projects endpoints
func (*ProjectsClient) Create ¶
func (p *ProjectsClient) Create(ctx context.Context, org *identity.ID, name string) (*ProjectResult, error)
Create creates a new project with the given name within the given org
func (*ProjectsClient) GetTree ¶ added in v0.19.0
func (p *ProjectsClient) GetTree(ctx context.Context, orgID *identity.ID) ([]ProjectTreeSegment, error)
GetTree returns a project tree
func (*ProjectsClient) List ¶
func (p *ProjectsClient) List(ctx context.Context, orgIDs *[]*identity.ID, names *[]string) ([]ProjectResult, error)
List retrieves relevant projects by name and/or orgID
type ServiceResult ¶
type ServiceResult struct { ID *identity.ID `json:"id"` Version uint8 `json:"version"` Body *primitive.Service `json:"body"` }
ServiceResult is the payload returned for a service object
type ServicesClient ¶
type ServicesClient struct {
// contains filtered or unexported fields
}
ServicesClient makes proxied requests to the registry's services endpoints
func (*ServicesClient) Create ¶
func (s *ServicesClient) Create(ctx context.Context, orgID, projectID *identity.ID, name string) error
Create performs a request to create a new service object
func (*ServicesClient) List ¶
func (s *ServicesClient) List(ctx context.Context, orgIDs, projectIDs *[]*identity.ID, names *[]string) ([]ServiceResult, error)
List retrieves relevant services by name and/or orgID and/or projectID
type Session ¶ added in v0.15.0
type Session struct {
// contains filtered or unexported fields
}
Session represents the current logged in entities identity and authentication objects which could be a Machine or User
func NewSession ¶ added in v0.15.0
NewSession returns a new session constructed from the payload of the current identity as returned from the Daemon
func (*Session) AuthID ¶ added in v0.15.0
AuthID returns the auth id (e.g. user or machine token id)
func (*Session) Email ¶ added in v0.15.0
Email returns none for a machine or the users email address
type SessionClient ¶
type SessionClient struct {
// contains filtered or unexported fields
}
SessionClient provides access to the daemon's user session related endpoints, for logging in/out, and checking your session status.
func (*SessionClient) Get ¶
func (s *SessionClient) Get(ctx context.Context) (*apitypes.SessionStatus, error)
Get returns the status of the user's session.
func (*SessionClient) Logout ¶
func (s *SessionClient) Logout(ctx context.Context) error
Logout logs the user out of their session
func (*SessionClient) MachineLogin ¶ added in v0.15.0
func (s *SessionClient) MachineLogin(ctx context.Context, tokenID, tokenSecret string) error
MachineLogin logs the user in using the provided token id and secret
type TeamResult ¶
type TeamResult struct { ID *identity.ID `json:"id"` Version uint8 `json:"version"` Body *primitive.Team `json:"body"` }
TeamResult is the payload returned for a team object
type TeamsClient ¶
type TeamsClient struct {
// contains filtered or unexported fields
}
TeamsClient makes proxied requests to the registry's teams endpoints
func (*TeamsClient) Create ¶
func (t *TeamsClient) Create(ctx context.Context, orgID *identity.ID, name string, teamType primitive.TeamType) (*apitypes.Team, error)
Create performs a request to create a new team object
func (*TeamsClient) GetByName ¶
func (t *TeamsClient) GetByName(ctx context.Context, orgID *identity.ID, name string) ([]TeamResult, error)
GetByName retrieves the team with the specified name
func (*TeamsClient) GetByOrg ¶
func (t *TeamsClient) GetByOrg(ctx context.Context, orgID *identity.ID) ([]TeamResult, error)
GetByOrg retrieves all teams for an org id
type UserResult ¶
type UserResult struct { ID *identity.ID `json:"id"` Version uint8 `json:"version"` Body *primitive.User `json:"body"` }
UserResult is the payload returned for a user object
type UsersClient ¶
type UsersClient struct {
// contains filtered or unexported fields
}
UsersClient makes proxied requests to the registry's users endpoints
func (*UsersClient) Signup ¶
func (u *UsersClient) Signup(ctx context.Context, signup *apitypes.Signup, output *ProgressFunc) (*UserResult, error)
Signup will have the daemon create a new user request
func (*UsersClient) Update ¶ added in v0.17.0
func (u *UsersClient) Update(ctx context.Context, delta apitypes.ProfileUpdate) (*UserResult, error)
Update performs a profile update to the user object
func (*UsersClient) VerifyEmail ¶ added in v0.8.0
func (u *UsersClient) VerifyEmail(ctx context.Context, verifyCode string) error
VerifyEmail will confirm the user's email with the registry
type VersionClient ¶
type VersionClient struct {
// contains filtered or unexported fields
}
VersionClient provides access to the daemon's /v1/version endpoint, for inspecting the daemon's release version.
func (*VersionClient) GetRegistry ¶
GetRegistry returns the registry's release version.
type WorklogClient ¶ added in v0.12.0
type WorklogClient struct {
// contains filtered or unexported fields
}
WorklogClient views and resolves worklog items in the daemon.
func (*WorklogClient) Get ¶ added in v0.12.0
func (w *WorklogClient) Get(ctx context.Context, orgID *identity.ID, ident *apitypes.WorklogID) (*apitypes.WorklogItem, error)
Get returns the worklog item with the given id in the given org.
func (*WorklogClient) List ¶ added in v0.12.0
func (w *WorklogClient) List(ctx context.Context, orgID *identity.ID) ([]apitypes.WorklogItem, error)
List returns the list of all worklog items in the given org.