apitypes

package
v0.13.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2016 License: AGPL-3.0 Imports: 10 Imported by: 35

Documentation

Overview

Package apitypes defines types shared between the daemon and its api client.

Index

Constants

View Source
const (
	BadRequestError     = "bad_request"
	UnauthorizedError   = "unauthorized"
	NotFoundError       = "not_found"
	InternalServerError = "internal_server"
	NotImplementedError = "not_implemented"
)

These are the possible error types.

View Source
const (
	SuccessWorklogResult = "success"
	FailureWorklogResult = "failure"
	ErrorWorklogResult   = "error"
	ManualWorklogResult  = "manual"
)

WorklogResult result states.

Variables

View Source
var ErrIncorrectWorklogIDLen = errors.New("Incorrect worklog ID length")

ErrIncorrectWorklogIDLen is returned when a base32 encoded worklog id is the wrong length.

Functions

func IsNotFoundError added in v0.12.0

func IsNotFoundError(err error) bool

IsNotFoundError returns whether or not an error is a 404 result from the api.

Types

type BaseCredential added in v0.11.0

type BaseCredential struct {
	Name      string           `json:"name"`
	OrgID     *identity.ID     `json:"org_id"`
	PathExp   *pathexp.PathExp `json:"pathexp"`
	ProjectID *identity.ID     `json:"project_id"`
	Value     *CredentialValue `json:"value"`
}

BaseCredential is the body of an unencrypted Credential

func (*BaseCredential) GetName added in v0.11.0

func (c *BaseCredential) GetName() string

GetName returns the name

func (*BaseCredential) GetOrgID added in v0.11.0

func (c *BaseCredential) GetOrgID() *identity.ID

GetOrgID returns the org id

func (*BaseCredential) GetPathExp added in v0.11.0

func (c *BaseCredential) GetPathExp() *pathexp.PathExp

GetPathExp returns the pathexp

func (*BaseCredential) GetProjectID added in v0.11.0

func (c *BaseCredential) GetProjectID() *identity.ID

GetProjectID returns the project id

func (*BaseCredential) GetValue added in v0.11.0

func (c *BaseCredential) GetValue() *CredentialValue

GetValue returns the value object, unless unset then returns nil

type Credential

type Credential interface {
	GetName() string
	GetOrgID() *identity.ID
	GetPathExp() *pathexp.PathExp
	GetProjectID() *identity.ID
	GetValue() *CredentialValue
}

Credential interface is either a v1 or v2 credential object

type CredentialEnvelope

type CredentialEnvelope struct {
	ID      *identity.ID `json:"id"`
	Version uint8        `json:"version"`
	Body    *Credential  `json:"body"`
}

CredentialEnvelope is an unencrypted credential object with a deserialized body

type CredentialResp added in v0.11.0

type CredentialResp struct {
	ID      *identity.ID    `json:"id"`
	Version uint8           `json:"version"`
	Body    json.RawMessage `json:"body"`
}

CredentialResp is used to facilitate unmarshalling of versioned objects

type CredentialV2 added in v0.11.0

type CredentialV2 struct {
	BaseCredential
	State string `json:"state"`
}

CredentialV2 is the body of an unencrypted Credential

func (*CredentialV2) GetValue added in v0.11.0

func (c *CredentialV2) GetValue() *CredentialValue

GetValue returns the value object, unless unset then returns nil

type CredentialValue

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

CredentialValue is the raw value of a credential.

func NewFloatCredentialValue added in v0.8.0

func NewFloatCredentialValue(f float64) *CredentialValue

NewFloatCredentialValue creates a CredentialValue with a float value.

func NewIntCredentialValue added in v0.8.0

func NewIntCredentialValue(i int) *CredentialValue

NewIntCredentialValue creates a CredentialValue with an int value.

func NewStringCredentialValue added in v0.8.0

func NewStringCredentialValue(s string) *CredentialValue

NewStringCredentialValue creates a CredentialValue with a string value.

func NewUnsetCredentialValue added in v0.8.0

func NewUnsetCredentialValue() *CredentialValue

NewUnsetCredentialValue creates a CredentialValue with an unset value.

func (*CredentialValue) IsUnset

func (c *CredentialValue) IsUnset() bool

IsUnset returns if this credential has been unset (deleted)

func (*CredentialValue) MarshalJSON added in v0.8.0

func (c *CredentialValue) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*CredentialValue) String

func (c *CredentialValue) String() string

String returns the string representation of this credential. It panics if the credential was deleted.

func (*CredentialValue) UnmarshalJSON

func (c *CredentialValue) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type Environment

type Environment struct {
	ID      string                 `json:"id"`
	Version int                    `json:"version"`
	Body    *primitive.Environment `json:"body"`
}

Environment contains information for creating a new Env object

type Error

type Error struct {
	StatusCode int

	Type string   `json:"type"`
	Err  []string `json:"error"`
}

Error represents standard formatted API errors from the daemon or registry.

func (*Error) Error

func (e *Error) Error() string

Error implements the error interface for formatted API errors.

type ErrorType

type ErrorType string

ErrorType represents the string error types that the daemon and registry can return.

type InviteAccept

type InviteAccept struct {
	Org   string `json:"org"`
	Email string `json:"email"`
	Code  string `json:"code"`
}

InviteAccept contains data required to accept org invite

type Login

type Login struct {
	Email      string `json:"email"`
	Passphrase string `json:"passphrase"`
}

Login contains the required details for logging in to the api and daemon.

type Membership added in v0.8.0

type Membership struct {
	ID      *identity.ID          `json:"id"`
	Version int                   `json:"version"`
	Body    *primitive.Membership `json:"body"`
}

Membership contains data required to be added to a team

type OrgInvite

type OrgInvite struct {
	ID      string               `json:"id"`
	Version int                  `json:"version"`
	Body    *primitive.OrgInvite `json:"body"`
}

OrgInvite contains information for sending an Org invite

type Profile

type Profile struct {
	ID   *identity.ID `json:"id"`
	Body *struct {
		Name     string `json:"name"`
		Username string `json:"username"`
	} `json:"body"`
}

Profile contains the fields in the response for the profiles endpoint

type Service

type Service struct {
	ID      *identity.ID       `json:"id"`
	Version int                `json:"version"`
	Body    *primitive.Service `json:"body"`
}

Service contains information for creating a new Service object

type SessionStatus

type SessionStatus struct {
	Token      bool `json:"token"`
	Passphrase bool `json:"passphrase"`
}

SessionStatus contains details about the user's daemon session.

type Signup

type Signup struct {
	Name       string
	Username   string
	Email      string
	Passphrase string
	InviteCode string
	OrgName    string
	OrgInvite  bool
}

Signup contains information required for registering an account

type Team

type Team struct {
	ID      *identity.ID    `json:"id"`
	Version int             `json:"version"`
	Body    *primitive.Team `json:"body"`
}

Team contains information for creating a new Team object

type VerifyEmail added in v0.8.0

type VerifyEmail struct {
	Code string `json:"code"`
}

VerifyEmail contains email verification code

type Version

type Version struct {
	Version string `json:"version"`
}

Version contains the release version of the daemon.

type WorklogID added in v0.12.0

type WorklogID [worklogIDLen]byte

WorklogID is the unique content-based identifier for worklog entries

func DecodeWorklogIDFromString added in v0.12.0

func DecodeWorklogIDFromString(raw string) (WorklogID, error)

DecodeWorklogIDFromString decodes a WorklogID from the given base32 encoded representation.

func (WorklogID) String added in v0.12.0

func (id WorklogID) String() string

type WorklogItem added in v0.12.0

type WorklogItem struct {
	ID      *WorklogID `json:"id"`
	Subject string     `json:"subject"`
	Summary string     `json:"summary"`
}

WorklogItem is an item that the daemon has identified as needing to be done to ensure system correctness, or security in the face of stale secrets.

func (*WorklogItem) CreateID added in v0.12.0

func (w *WorklogItem) CreateID(worklogType WorklogType)

CreateID creates and populates a WorklogID for the WorklogItem based on the given type and its subject.

func (*WorklogItem) Type added in v0.12.0

func (w *WorklogItem) Type() WorklogType

Type returns this item's type

type WorklogResult added in v0.12.0

type WorklogResult struct {
	ID      *WorklogID `json:"id"`
	State   string     `json:"state"`
	Message string     `json:"message"`
}

WorklogResult is the result, either positive or negative, of attempting to resolve a WorklogItem

type WorklogType added in v0.12.0

type WorklogType byte

WorklogType is the enumerated byte type of WorklogItems

const (
	SecretRotateWorklogType WorklogType = 1 << iota
)

The enumberated byte types of WorklogItems

func (WorklogType) String added in v0.12.0

func (t WorklogType) String() string

String returns a human reable string for this worklog item type.

Jump to

Keyboard shortcuts

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