api

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2018 License: BSD-3-Clause Imports: 16 Imported by: 13

Documentation

Overview

Package api provides the daemon API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	registry.Client

	// Endpoints with daemon specific overrides
	Users      *UsersClient
	Machines   *MachinesClient
	KeyPairs   *KeyPairsClient
	OrgInvites *OrgInvitesClient
	Version    *VersionClient

	// Daemon only endpoints
	Session     *SessionClient
	Credentials *CredentialsClient // this replaces the registry endpoint
	Worklog     *WorklogClient
	Updates     *UpdatesClient

	// Cryptography related registry endpoints that should be accessed
	// via the daemon.
	Tokens          blacklisted
	Keyring         blacklisted
	KeyringMember   blacklisted
	Claims          blacklisted
	ClaimTree       blacklisted
	CredentialGraph blacklisted
}

Client exposes the daemon API.

func NewClient

func NewClient(cfg *config.Config) *Client

NewClient returns a new Client.

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

Create creates the given credential

func (*CredentialsClient) Get

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, teamIDs []identity.ID, p ProgressFunc) ([]apitypes.CredentialEnvelope, error)

Search returns all credentials at the given pathexp in an undecrypted state

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 KeyPairsClient added in v0.22.0

type KeyPairsClient struct {
	*registry.KeyPairsClient
	// contains filtered or unexported fields
}

KeyPairsClient makes requests to the registry's and daemon's keypairs endpoints

func (*KeyPairsClient) Create added in v0.22.0

func (k *KeyPairsClient) Create(ctx context.Context, orgID *identity.ID, output ProgressFunc) error

Create generates new keypairs for the user in the given org.

func (*KeyPairsClient) Revoke added in v0.22.0

func (k *KeyPairsClient) Revoke(ctx context.Context, orgID *identity.ID, output ProgressFunc) error

Revoke revokes the existing keypairs for the user in the given org.

type MachinesClient added in v0.15.0

type MachinesClient struct {
	*registry.MachinesClient
	// 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

type OrgInvitesClient added in v0.22.0

type OrgInvitesClient struct {
	*registry.OrgInvitesClient
	// contains filtered or unexported fields
}

OrgInvitesClient makes requests to the registry's and daemon's org invites endpoints

func (*OrgInvitesClient) Approve added in v0.22.0

func (i *OrgInvitesClient) Approve(ctx context.Context, inviteID identity.ID, output ProgressFunc) error

Approve executes the approve invite request

type ProgressFunc

type ProgressFunc func(event *Event, err error)

ProgressFunc is used to output events

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

func NewSession(resp *apitypes.Self) (*Session, error)

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

func (s *Session) AuthID() *identity.ID

AuthID returns the auth id (e.g. user or machine token id)

func (*Session) Email added in v0.15.0

func (s *Session) Email() string

Email returns none for a machine or the users email address

func (*Session) ID added in v0.15.0

func (s *Session) ID() *identity.ID

ID returns the identity ID (e.g. user or machine id)

func (*Session) Name added in v0.15.0

func (s *Session) Name() string

Name returns the fullname of the user or the machine name

func (*Session) State added in v0.30.0

func (s *Session) State() string

State returns the status of the machine or user

func (*Session) Type added in v0.15.0

func (s *Session) Type() apitypes.SessionType

Type returns the type of the session (machine or user)

func (*Session) Username added in v0.15.0

func (s *Session) Username() string

Username returns the username or machine name depending on the session type

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

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

func (*SessionClient) UserLogin added in v0.15.0

func (s *SessionClient) UserLogin(ctx context.Context, email, passphrase string) error

UserLogin logs the user in using the provided email and passphrase

func (*SessionClient) Who added in v0.15.0

func (s *SessionClient) Who(ctx context.Context) (*Session, error)

Who returns the Session object for the current authenticated user or machine

type UpdatesClient added in v0.23.0

type UpdatesClient struct {
	// contains filtered or unexported fields
}

UpdatesClient checks if there are updates available coming from the daemon update checker component.

func (*UpdatesClient) Check added in v0.23.0

Check returns the latest updates check result, useful for detecting whether a newer version of Torus is available for download.

type UsersClient

type UsersClient struct {
	*registry.UsersClient
	// contains filtered or unexported fields
}

UsersClient makes requests to the registry's and daemon's users endpoints

func (*UsersClient) Create added in v0.22.0

func (u *UsersClient) Create(ctx context.Context, signup *apitypes.Signup, output *ProgressFunc) (envelope.UserInf, error)

Create will have the daemon create a new user request

func (*UsersClient) Update added in v0.17.0

Update performs a profile update to the user object

func (*UsersClient) Verify added in v0.30.0

func (u *UsersClient) Verify(ctx context.Context, code string) error

Verify verifies the users account using the given code

type VersionClient

type VersionClient struct {
	*registry.VersionClient
	// contains filtered or unexported fields
}

VersionClient provides access to the daemon's /v1/version endpoint, for inspecting the daemon's release version.

func (*VersionClient) GetDaemon added in v0.22.0

func (v *VersionClient) GetDaemon(ctx context.Context) (*apitypes.Version, error)

GetDaemon returns the daemon'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

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.

func (*WorklogClient) Resolve added in v0.12.0

func (w *WorklogClient) Resolve(ctx context.Context, orgID *identity.ID, ident *apitypes.WorklogID) error

Resolve resolves the worklog item with the given id in the given org.

Jump to

Keyboard shortcuts

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