api

package
v0.10.1-rc Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2016 License: AGPL-3.0 Imports: 15 Imported by: 0

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 {
	Orgs         *OrgsClient
	Users        *UsersClient
	Profiles     *ProfilesClient
	Teams        *TeamsClient
	Memberships  *MembershipsClient
	Invites      *InvitesClient
	Keypairs     *KeypairsClient
	Session      *SessionClient
	Services     *ServicesClient
	Policies     *PoliciesClient
	Environments *EnvironmentsClient
	Projects     *ProjectsClient
	Credentials  *CredentialsClient
	Version      *VersionClient
	// contains filtered or unexported fields
}

Client exposes the daemon API.

func NewClient

func NewClient(cfg *config.Config) *Client

NewClient returns a new Client.

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.

func (*Client) NewRequest

func (c *Client) NewRequest(method, path string, query *url.Values, body interface{}, proxied bool) (*http.Request, string, error)

NewRequest constructs a new http.Request, with a body containing the json representation of body, if provided.

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.

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, orgID, projectID *identity.ID, name *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

func (*InvitesClient) Send

func (i *InvitesClient) Send(ctx context.Context, email string, orgID, inviterID identity.ID, teamIDs []identity.ID) error

Send creates a new org invitation

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

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 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) Create added in v0.8.0

func (m *MembershipsClient) Create(ctx context.Context, userID, orgID, teamID *identity.ID) error

Create requests addition of a user to a team

func (*MembershipsClient) Delete

func (m *MembershipsClient) Delete(ctx context.Context, membership *identity.ID) error

Delete requests deletion of a specific membership row by ID

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 OrgsClient

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

OrgsClient makes proxied requests to the registry's orgs endpoints

func (*OrgsClient) Create

func (o *OrgsClient) Create(ctx context.Context, name string) (*OrgResult, error)

Create creates a new org with the given name. It returns the newly-created org.

func (*OrgsClient) GetByName

func (o *OrgsClient) GetByName(ctx context.Context, name string) (*OrgResult, error)

GetByName retrieves an org by its named

func (*OrgsClient) List

func (o *OrgsClient) List(ctx context.Context) ([]OrgResult, error)

List returns all organizations that the signed-in user has access to

type PoliciesClient

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

PoliciesClient makes proxied requests to the registry's policies endpoints

func (*PoliciesClient) Attach added in v0.8.0

func (p *PoliciesClient) Attach(ctx context.Context, org, policy, team *identity.ID) error

Attach attaches a policy to a team

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) Detach added in v0.8.0

func (p *PoliciesClient) Detach(ctx context.Context, attachmentID *identity.ID) error

Detach deletes a specific attachment

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

func (p *ProfilesClient) ListByName(ctx context.Context, name string) (*apitypes.Profile, error)

ListByName returns profiles looked up by username

type ProgressFunc

type ProgressFunc func(event *Event, err error)

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 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) List

func (p *ProjectsClient) List(ctx context.Context, orgID *identity.ID, name *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, orgID, projectID *identity.ID, name *string) ([]ServiceResult, error)

List retrieves relevant services by name and/or orgID and/or projectID

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) Login

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

Login logs the user in using the provided email and passphrase

func (*SessionClient) Logout

func (s *SessionClient) Logout(ctx context.Context) error

Logout logs the user out of their session

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) 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) Self

func (u *UsersClient) Self(ctx context.Context) (*UserResult, error)

Self retrieves the currently logged in user

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) 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) Get

Get returns the daemon's release version.

func (*VersionClient) GetRegistry

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

GetRegistry returns the registry's release version.

Jump to

Keyboard shortcuts

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