manifold

package module
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: BSD-3-Clause Imports: 25 Imported by: 43

README

go-manifold

Go client API for manifold (unstable)

Code of Conduct | Contribution Guidelines

GitHub release GoDoc Travis Go Report Card License

Overview

This will be the Go implementation of a client API for Manifold's non-provider facing REST services. For now, it is unstable as we build it, and is used to share code between some of our other packages.

If you are a provider, you'll want to look at grafton for verifying your implementation, or go-signature for verifying requests have come from Manifold instead.

Releasing

To release a new version of this package, use the Make target release:

$ VERSION=0.1.2 make release

This will update the Version in version.go, commit the changes and set up a new tag.

Documentation

Index

Constants

View Source
const AnnotationMaxReservedKeys = 20

AnnotationMaxReservedKeys defines the max number of reserved keys (Keys prefixed with manifold.co)

View Source
const AnnotationReservedKeyPrefix = "manifold.co"

AnnotationReservedKeyPrefix is the prefix a key must start with to be considered reserved

View Source
const DefaultURLPattern = "https://api.%s.manifold.co/v1"

DefaultURLPattern is the default pattern used for connecting to Manifold's API hosts.

View Source
const MetadataMaxSize = 10 * 1024

MetadataMaxSize defines the max size of the metadata JSON in bytes

View Source
const Version = "0.11.0"

Version is the package version of go-manifold. This gets automatically updated by running `make release`.

Variables

View Source
var (

	// ErrNotAManifoldID is an error returned when a Identifier is expected to
	//  be a Manifold ID, but is not.
	ErrNotAManifoldID = NewError(errors.BadRequestError,
		"Malformed Manifold ID, expected form `manifold.co/CLASS/MANIFOLDID`")
	// ErrManifoldIDTypeMismatch is an error returned when a Identifier is expected to
	//  be a Manifold ID, but is not because the type does not match.
	ErrManifoldIDTypeMismatch = NewError(errors.BadRequestError,
		"Invalid Manifold ID, expected CLASS from `manifold.co/CLASS/ID` to match ID Type")
)
View Source
var AnnotationKnownReservedKeys = []string{
	"manifold.co/tool",
	"manifold.co/package",
	"manifold.co/environment",
	"manifold.co/projects",
	"manifold.co/resource-template",
}

AnnotationKnownReservedKeys is an array of all the known reserved keys, any other key prefixed with the reserved key prefix will cause an error.

View Source
var ErrMetadataNonexistantKey = errors.New("Key does not exist")

ErrMetadataNonexistantKey describes and error for when the expected key is not present

View Source
var ErrMetadataUnexpectedValueType = errors.New("Found value but it was not the expected type")

ErrMetadataUnexpectedValueType describes and error when a metadata type isn't what's expected

Functions

This section is empty.

Types

type APIToken added in v0.8.5

type APIToken struct {
	ID      ID     `json:"id"`
	Version int    `json:"version"`
	Type    string `json:"type"`

	Body *struct {
		FirstFour   string  `json:"first_four"`
		LastFour    string  `json:"last_four"`
		Role        string  `json:"role"`
		UserID      ID      `json:"user_id"`
		TeamID      ID      `json:"team_id"`
		Token       *string `json:"token"` // Optional
		Description string  `json:"description"`
	} `json:"body"` // Optional
}

APIToken is a data type for API communication.

type APITokenIter added in v0.8.5

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

APITokenIter Iterates over a result set of APITokens.

func (*APITokenIter) Close added in v0.8.5

func (i *APITokenIter) Close()

Close closes the APITokenIter and releases any associated resources. After Close, any calls to Current will return an error.

func (*APITokenIter) Current added in v0.8.5

func (i *APITokenIter) Current() (*APIToken, error)

Current returns the current APIToken, and an optional error. Once an error has been returned, the APITokenIter is closed, or the end of iteration is reached, subsequent calls to Current will return an error.

func (*APITokenIter) Next added in v0.8.5

func (i *APITokenIter) Next() bool

Next advances the APITokenIter and returns a boolean indicating if the end has been reached. Next must be called before the first call to Current. Calls to Current after Next returns false will return an error.

type APITokenRequest added in v0.8.5

type APITokenRequest struct {
	Description string `json:"description"`
	Role        string `json:"role"`
	UserID      *ID    `json:"user_id"` // Optional
	TeamID      *ID    `json:"team_id"` // Optional
}

APITokenRequest is a data type for API communication.

type AcceptInvite added in v0.8.0

type AcceptInvite struct {
	Token string `json:"token"`
}

AcceptInvite is a data type for API communication.

type AnalyticsClient added in v0.8.0

type AnalyticsClient endpoint

AnalyticsClient provides access to the /analytics APIs

func (*AnalyticsClient) Create added in v0.8.0

func (c *AnalyticsClient) Create(ctx context.Context, analyticsEvent *AnalyticsEvent) error

Create corresponds to the POST /analytics/ endpoint.

An endpoint used by the cli to push analytics into segment.

type AnalyticsEvent added in v0.8.0

type AnalyticsEvent struct {
	EventName  string                    `json:"event_name"`
	UserID     ID                        `json:"user_id"`
	Properties *AnalyticsEventProperties `json:"properties"` // Optional
}

AnalyticsEvent is a data type for API communication.

type AnalyticsEventProperties added in v0.8.0

type AnalyticsEventProperties struct {
	Platform *string `json:"platform"` // Optional
}

AnalyticsEventProperties is a data type for API communication.

type AnnotationKey added in v0.9.5

type AnnotationKey string

AnnotationKey represents any annotation map's key

func (AnnotationKey) Validate added in v0.9.5

func (key AnnotationKey) Validate(_ interface{}) error

Validate ensures the annotation key is valid

type AnnotationValue added in v0.9.5

type AnnotationValue string

AnnotationValue represents any annotation map's value in the array of values

func (AnnotationValue) Validate added in v0.9.5

func (val AnnotationValue) Validate(_ interface{}) error

Validate ensures the annotation value is valid

type AnnotationsMap added in v0.9.5

type AnnotationsMap map[string][]string

AnnotationsMap defines a map of string arrays that contain the annotations data

func (AnnotationsMap) Equals added in v0.9.5

func (a AnnotationsMap) Equals(fm AnnotationsMap) bool

Equals checks the equality of another AnnotationsMap against this one

func (AnnotationsMap) Validate added in v0.9.5

func (a AnnotationsMap) Validate(_ interface{}) error

Validate validates this AnnotationsMap

type AuthToken added in v0.8.0

type AuthToken struct {
	ID      ID     `json:"id"`
	Version int    `json:"version"`
	Type    string `json:"type"`

	Body struct {
		Token     string `json:"token"`
		UserID    ID     `json:"user_id"`
		Mechanism string `json:"mechanism"`
	} `json:"body"`
}

AuthToken is a data type for API communication.

type AuthTokenRequest added in v0.8.0

type AuthTokenRequest struct {
	Type          string `json:"type"`
	LoginTokenSig string `json:"login_token_sig"`
}

AuthTokenRequest is a data type for API communication.

type Backend added in v0.8.0

type Backend interface {
	NewRequest(method, path string, query url.Values, body interface{}) (*http.Request, error)
	Do(ctx context.Context, request *http.Request, v interface{}, errFn func(int) error) (*http.Response, error)
}

Backend defines the low-level interface for communicating with the remote api.

func DefaultBackend added in v0.8.0

func DefaultBackend() Backend

DefaultBackend returns an instance of the default Backend configuration.

type CatalogClient added in v0.8.0

type CatalogClient struct {
	Plans     *PlansClient
	Products  *ProductsClient
	Providers *ProvidersClient
	Regions   *RegionsClient
	// contains filtered or unexported fields
}

CatalogClient is an API client for all endpoints.

func NewCatalog added in v0.8.0

func NewCatalog() *CatalogClient

NewCatalog returns a new CatalogClient with the default configuration.

type Class added in v0.9.10

type Class Label

Class is a Manifold Label that is used to represent the class of an ID

func (Class) Label added in v0.9.10

func (c Class) Label() Label

Label implements the Stringer interface to easily convert a Class to a Manifold Label

func (Class) String added in v0.9.10

func (c Class) String() string

String implements the Stringer interface to easily convert a Class to a String

func (Class) Validate added in v0.9.10

func (c Class) Validate(r strfmt.Registry) error

Validate implements the runtime Validatable interface

type Client added in v0.8.0

type Client struct {
	IdentityClient
	CatalogClient
	MarketplaceClient
	// contains filtered or unexported fields
}

Client is the Manifold API client.

func New added in v0.8.0

func New(cfgs ...ConfigFunc) *Client

New returns a new API client with the default configuration

type Code added in v0.7.2

type Code string

Code represents a manifold verification code ( E-Mail Verification )

func (Code) Validate added in v0.7.2

func (c Code) Validate(_ interface{}) error

Validate ensures the name value is valid

type ConfigFunc added in v0.8.0

type ConfigFunc func(*Client)

ConfigFunc is a func that configures the client during New

func ForURLPattern added in v0.8.0

func ForURLPattern(pattern string) ConfigFunc

ForURLPattern returns a configuration func to set the URL pattern for all endpoints.

func WithAPIToken added in v0.8.3

func WithAPIToken(token string) ConfigFunc

WithAPIToken returns a configuration func to set the API key to use for authentication.

func WithUserAgent added in v0.8.4

func WithUserAgent(agent string) ConfigFunc

WithUserAgent sets a specific user agent on the client. This will overwrite any 'User-Agent' header that has been set before. We will prepend the specified agent with `go-manifold-$version`.

type CreateInvite added in v0.8.0

type CreateInvite struct {
	Body CreateInviteBody `json:"body"`
}

CreateInvite is a data type for API communication.

type CreateInviteBody added in v0.8.0

type CreateInviteBody struct {
	Name   string  `json:"name"`
	Role   *string `json:"role"` // Optional
	Email  string  `json:"email"`
	TeamID ID      `json:"team_id"`
}

CreateInviteBody is a data type for API communication.

type CreatePlan added in v0.8.0

type CreatePlan struct {
	Body PlanBody `json:"body"`
}

CreatePlan is a data type for API communication.

type CreateProduct added in v0.8.0

type CreateProduct struct {
	Body ProductBody `json:"body"`
}

CreateProduct is a data type for API communication.

type CreateProject added in v0.8.0

type CreateProject struct {
	Body CreateProjectBody `json:"body"`
}

CreateProject is a data type for API communication.

type CreateProjectBody added in v0.8.0

type CreateProjectBody struct {
	UserID      *ID     `json:"user_id"` // Optional
	TeamID      *ID     `json:"team_id"` // Optional
	Name        string  `json:"name"`
	Label       string  `json:"label"`
	Description *string `json:"description"` // Optional
}

CreateProjectBody is a data type for API communication.

type CreateProvider added in v0.8.0

type CreateProvider struct {
	Body ProviderBody `json:"body"`
}

CreateProvider is a data type for API communication.

type CreateRegion added in v0.8.0

type CreateRegion struct {
	Body RegionBody `json:"body"`
}

CreateRegion is a data type for API communication.

type CreateTeam added in v0.8.0

type CreateTeam struct {
	Body CreateTeamBody `json:"body"`
}

CreateTeam is a data type for API communication.

type CreateTeamBody added in v0.8.0

type CreateTeamBody struct {
	Name  string `json:"name"`
	Label string `json:"label"`
}

CreateTeamBody is a data type for API communication.

type CreateUser added in v0.8.0

type CreateUser struct {
	Body CreateUserBody `json:"body"`
}

CreateUser is a data type for API communication.

type CreateUserBody added in v0.8.0

type CreateUserBody struct {
	Name      string         `json:"name"`
	Email     string         `json:"email"`
	PublicKey LoginPublicKey `json:"public_key"`
}

CreateUserBody is a data type for API communication.

type Credential added in v0.8.0

type Credential struct {
	ID      ID     `json:"id"`
	Type    string `json:"type"`
	Version int    `json:"version"`

	Body struct {
		ResourceID ID `json:"resource_id"`

		// Map of configuration variable names to values, names
		// must IEEE 1003.1 - 2001 Standard (checked in code).
		Values    map[string]string `json:"values"`
		Source    string            `json:"source"`
		CreatedAt string            `json:"created_at"`
		UpdatedAt string            `json:"updated_at"`
	} `json:"body"`
}

Credential is a data type for API communication.

type CredentialBody added in v0.9.11

type CredentialBody string

CredentialBody represents the body for a secret credential associated with a resource

func (CredentialBody) Validate added in v0.9.11

func (body CredentialBody) Validate(_ interface{}) error

Validate ensures the credential body is valid

type CredentialIter added in v0.8.0

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

CredentialIter Iterates over a result set of Credentials.

func (*CredentialIter) Close added in v0.8.0

func (i *CredentialIter) Close()

Close closes the CredentialIter and releases any associated resources. After Close, any calls to Current will return an error.

func (*CredentialIter) Current added in v0.8.0

func (i *CredentialIter) Current() (*Credential, error)

Current returns the current Credential, and an optional error. Once an error has been returned, the CredentialIter is closed, or the end of iteration is reached, subsequent calls to Current will return an error.

func (*CredentialIter) Next added in v0.8.0

func (i *CredentialIter) Next() bool

Next advances the CredentialIter and returns a boolean indicating if the end has been reached. Next must be called before the first call to Current. Calls to Current after Next returns false will return an error.

type CredentialKey added in v0.9.11

type CredentialKey string

CredentialKey represents a key for a secret credential associated with a resource

func (CredentialKey) Validate added in v0.9.11

func (key CredentialKey) Validate(_ interface{}) error

Validate ensures the credential key is valid

type CredentialsClient added in v0.8.0

type CredentialsClient endpoint

CredentialsClient provides access to the /credentials APIs

func (*CredentialsClient) List added in v0.8.0

List corresponds to the GET /credentials endpoint.

List credentials

type CredentialsListOpts added in v0.9.3

type CredentialsListOpts struct {
	// ID of the Resource to filter Credentials by, stored as a
	// base32 encoded 18 byte identifier.
	ResourceID *[]ID `json:"resource_id"`

	// ID of the Project to filter Credentials by, stored as a
	// base32 encoded 18 byte identifier.
	ProjectID *ID `json:"project_id"`
}

CredentialsListOpts holds optional argument values

type Domain added in v0.9.9

type Domain string

Domain is a string that can be Validated based on Regex to expect a string

that represents a Domain
const (

	// ManifoldDomain is the domain name used to identify Manifold IDs
	ManifoldDomain Domain = "manifold.co"
)

func (Domain) String added in v0.9.10

func (d Domain) String() string

String implements the Stringer interface to easily convert a Domain to a String

func (Domain) SubDomain added in v0.9.9

func (d Domain) SubDomain() string

SubDomain returns the subdomain portion of the domain

func (Domain) Validate added in v0.9.9

func (d Domain) Validate(_ strfmt.Registry) error

Validate ensures the name value is valid

type Email

type Email string

Email represents any email field

func (Email) Validate

func (e Email) Validate(_ interface{}) error

Validate ensures that the email is valid

type Error

type Error struct {
	Type     errors.Type `json:"type"`
	Messages []string    `json:"message"`
}

Error represents an Error returned by this Middleware to a requestor

func FromError

func FromError(err error) *Error

FromError returns an error of type Error from a struct that represents a

func NewError

func NewError(t errors.Type, m ...string) *Error

NewError returns an Error containing 1 or more error messages

func (*Error) Code

func (e *Error) Code() int32

Code returns the HTTP Status Code associated with this Error, completes the go-openapi error interface.

func (*Error) Error

func (e *Error) Error() string

Error returns the error message represented by this Error

func (*Error) StatusCode

func (e *Error) StatusCode() int

StatusCode returns the HTTP Status Code associated with this error, completes the HTTPError interface.

func (*Error) WriteResponse

func (e *Error) WriteResponse(w http.ResponseWriter, pr runtime.Producer)

WriteResponse completes the interface for a middleware.Responder from go-openapi/runtime

A panic will occur if the given producer errors.

type ExternalID added in v0.9.9

type ExternalID string

ExternalID is a string that can be Validated based on Regex to expect a string

representative of an ExternalID

func (ExternalID) String added in v0.9.10

func (eid ExternalID) String() string

String implements the Stringer interface to easily convert a ExternalID to a String

func (ExternalID) Validate added in v0.9.9

func (eid ExternalID) Validate(_ strfmt.Registry) error

Validate ensures the name value is valid

type FeatureMap added in v0.9.2

type FeatureMap map[string]interface{}

FeatureMap stores the selected feature values for a Manifold resource

func (FeatureMap) Equals added in v0.9.2

func (f FeatureMap) Equals(fm FeatureMap) bool

Equals checks the equality of another FeatureMap against this one

type FeatureType added in v0.8.0

type FeatureType struct {
	Label string `json:"label"`
	Name  string `json:"name"`
	Type  string `json:"type"`
}

FeatureType is a data type for API communication. A feature type represents the different aspects of a product that are offered, these features can manifest differently depending on the plan.

type FeatureValue added in v0.8.0

type FeatureValue struct {
	Feature string `json:"feature"`
	Value   string `json:"value"`
}

FeatureValue is a data type for API communication.

type FeatureValueLabel added in v0.9.3

type FeatureValueLabel string

FeatureValueLabel represents any object's label field

func (FeatureValueLabel) Validate added in v0.9.3

func (lbl FeatureValueLabel) Validate(_ interface{}) error

Validate ensures the label value is valid

type FlexID added in v0.9.9

type FlexID [3]string

FlexID is an implementation of Identifier that is designed to store internal

and external IDs it could still store InternalIDs but the InternalID type is
preferred as it is directly translatable to a `ID`

func FlexIDFromID added in v0.9.10

func FlexIDFromID(id ID) *FlexID

FlexIDFromID takes a Manifold ID and converts it to a FlexID for storage

func NewFlexID added in v0.9.10

func NewFlexID(d Domain, c Class, id ExternalID) (*FlexID, error)

NewFlexID constructs a FlexID from the provided Domain, Class, and ID parts

func (FlexID) AsFlexID added in v0.9.9

func (id FlexID) AsFlexID() *FlexID

AsFlexID returns the ID as the FlexID type as required by the Identifier interface

func (FlexID) AsManifoldID added in v0.9.10

func (id FlexID) AsManifoldID() (*ID, error)

AsManifoldID validates that the FlexID adheres with the requirements of a ManifoldID

and attempts to cast it to one

func (FlexID) Class added in v0.9.10

func (id FlexID) Class() Class

Class returns the type portion as string

func (FlexID) Domain added in v0.9.9

func (id FlexID) Domain() Domain

Domain returns the domain portion as a string

func (FlexID) Equals added in v0.9.11

func (id FlexID) Equals(oid Identifier) bool

Equals is implemented to allow for easy comparison of FlexIDs to IDs using the

Identifier interface

func (FlexID) ID added in v0.9.9

func (id FlexID) ID() ExternalID

ID returns the ID portion as a string

func (FlexID) IsEmpty added in v0.9.11

func (id FlexID) IsEmpty() bool

IsEmpty checks if the FlexID is considered empty or not

func (FlexID) MarshalJSON added in v0.9.9

func (id FlexID) MarshalJSON() ([]byte, error)

MarshalJSON implements the encoding/json.Marshaler interface

func (FlexID) MarshalText added in v0.9.9

func (id FlexID) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface

func (FlexID) String added in v0.9.9

func (id FlexID) String() string

String implements the Stringer interface for go

func (*FlexID) UnmarshalJSON added in v0.9.9

func (id *FlexID) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the encoding/json.Unmarshaler interface

func (*FlexID) UnmarshalText added in v0.9.9

func (id *FlexID) UnmarshalText(b []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface

func (FlexID) Validate added in v0.9.9

func (id FlexID) Validate(v strfmt.Registry) error

Validate implements the Validate interface for goswagger

which always succeeds because the ID is already parsed

type ForgotPassword added in v0.8.0

type ForgotPassword struct {
	Email     string         `json:"email"`
	Token     string         `json:"token"`
	PublicKey LoginPublicKey `json:"public_key"`
}

ForgotPassword is a data type for API communication.

type ForgotPasswordCreate added in v0.8.0

type ForgotPasswordCreate struct {
	Email string `json:"email"`
}

ForgotPasswordCreate is a data type for API communication.

type HTTPError

type HTTPError interface {
	error
	StatusCode() int
	WriteResponse(http.ResponseWriter, runtime.Producer)
}

HTTPError interface represents an error that is returned to a user as an HTTP response

func ToError

func ToError(err error) HTTPError

ToError receives an error and mutates it into an Error based on the concrete type of the Error.

type ID

type ID [byteLength]byte

ID is an encoded unique identifier for an object.

The first byte holds the schema version of the id itself. The second byte holds the type of the object. The remaining 16 bytes hold a digest of the contents of the object for immutable objects, or a random value for mutable objects.

func DecodeIDFromString added in v0.0.2

func DecodeIDFromString(value string) (ID, error)

DecodeIDFromString returns an ID that is stored in the given string.

func DeriveMutableID added in v0.0.2

func DeriveMutableID(body Mutable, base ID, derivableType idtype.Type) ID

DeriveMutableID returns a ID for a mutable object based on another ID.

func MustNewID added in v0.12.0

func MustNewID(t idtype.Type) ID

MustNewID returns a new ID for a Mutable idtype using only the Type It panics if NewID returns an error

func MustNewImmutableID added in v0.14.0

func MustNewImmutableID(obj Immutable, sig interface{}) ID

MustNewImmutableID returns a new signed ID for an immutable object. It panics if NewImmutableID returns an error

func NewFakeMutableID added in v0.0.2

func NewFakeMutableID(body Mutable, source string) (ID, error)

NewFakeMutableID returns an ID for a fake mutable object, not relying on the Body contents of the supplied mutable to generate the ID

func NewID

func NewID(t idtype.Type) (ID, error)

NewID returns a new ID for a Mutable idtype using only the Type

func NewImmutableID added in v0.0.2

func NewImmutableID(obj Immutable, sig interface{}) (ID, error)

NewImmutableID returns a new signed ID for an immutable object.

sig should be a registry.Signature type

func NewMutableID added in v0.0.2

func NewMutableID(body Mutable) (ID, error)

NewMutableID returns a new ID for a mutable object.

func (ID) AsFlexID added in v0.9.10

func (id ID) AsFlexID() *FlexID

AsFlexID converts the ID to a FlexID

func (ID) AsManifoldID added in v0.9.11

func (id ID) AsManifoldID() (*ID, error)

AsManifoldID returns the ID as itself without error, implemented to adhere

to the Identifier interface

func (ID) Class added in v0.9.10

func (id ID) Class() Class

Class returns the type of the ID as a Class

func (ID) Domain added in v0.9.10

func (id ID) Domain() Domain

Domain returns the domain portion as a string

func (ID) Equals added in v0.5.0

func (id ID) Equals(oid Identifier) bool

Equals is implemented to allow for easy comparison of FlexIDs to IDs using the

Identifier interface

func (ID) ID added in v0.9.10

func (id ID) ID() ExternalID

ID returns the Manifold ID as an ExternalID string

func (ID) IsEmpty added in v0.0.3

func (id ID) IsEmpty() bool

IsEmpty returns whether or not the ID is empty (all zeros)

func (ID) MarshalText added in v0.8.0

func (id ID) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for IDs.

IDs are encoded in unpadded base32.

func (ID) String

func (id ID) String() string

func (ID) Type

func (id ID) Type() idtype.Type

Type returns the idtype.Type encoded object type represented by this ID.

func (*ID) UnmarshalText added in v0.8.0

func (id *ID) UnmarshalText(b []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for IDs.

func (ID) Validate

func (id ID) Validate(_ strfmt.Registry) error

Validate implements the Validate interface for goswagger. We know that if the value has successfully parsed, it is valid, so no action is required.

type Identifiable

type Identifiable interface {
	GetID() ID
	Version() int
	Type() idtype.Type
}

Identifiable is the interface implemented by objects that can be given IDs.

type Identifier added in v0.9.10

type Identifier interface {
	fmt.Stringer
	runtime.Validatable

	// Domain returns the Domain ( first ) portion of the Identifier
	Domain() Domain
	// Class returns the Class ( second ) portion of the Identifier
	Class() Class
	// ID returns the ID ( third ) portion of the Identifier
	ID() ExternalID
	// AsFlexID allows for easy conversion of all Identifiers to the most forgiving struct
	AsFlexID() *FlexID
	// AsManifoldID allows for conversion of all Identifiers to a Manifold identifier if
	//  compatible, otherwise an error is returned and the ID is nil
	AsManifoldID() (*ID, error)
	// IsEmpty returns true if the ID is considered empty
	IsEmpty() bool
	// Equals checks the equality of this Identifier against another
	Equals(Identifier) bool
}

Identifier is an ID that also includes the domain, and type of the identifier.

Composed as: DOMAIN / CLASS / ID
Example: manifold.co/user/2003btphq7z6dzvjut370jkvkdgcp
Has `manifold.co` as the domain, a type of `user`, followed by the Manifold ID.

type IdentityClient added in v0.8.0

type IdentityClient struct {
	Analytics   *AnalyticsClient
	Invites     *InvitesClient
	Memberships *MembershipsClient
	Self        *SelfClient
	Teams       *TeamsClient
	Tokens      *TokensClient
	Users       *UsersClient
	// contains filtered or unexported fields
}

IdentityClient is an API client for all endpoints.

func NewIdentity added in v0.8.0

func NewIdentity() *IdentityClient

NewIdentity returns a new IdentityClient with the default configuration.

func (*IdentityClient) Login added in v0.8.0

func (c *IdentityClient) Login(ctx context.Context, email, password string) (string, error)

Login logs a user in to Manifold using the provided email and password. It returns the user's JWT auth token on success. This token is not stored on the API client; you must instantiate a new one to use it.

type Immutable

type Immutable interface {
	Identifiable
	GetBody() interface{}
	Immutable() // We don't ever need to call this, its just for type checking.
}

Immutable structs are Identifiables that do not change, and should be signed.

type InternalClient added in v0.8.0

type InternalClient endpoint

InternalClient provides access to the /internal APIs

func (*InternalClient) DeleteProjects added in v0.8.0

func (c *InternalClient) DeleteProjects(ctx context.Context, id ID) error

DeleteProjects corresponds to the DELETE /internal/projects/:id endpoint.

Internal delete project route End-point used by the Provisioning Worker to delete a project. provisioning handles the deletion to ensure no concurrent operations are using the project.

type Invite added in v0.8.0

type Invite struct {
	ID      ID     `json:"id"`
	Type    string `json:"type"`
	Version int    `json:"version"`

	Body struct {
		Name      string `json:"name"`
		Email     string `json:"email"`
		TeamID    ID     `json:"team_id"`
		Role      string `json:"role"`
		InvitedBy *ID    `json:"invited_by"` // Optional
		Token     string `json:"token"`
	} `json:"body"`
}

Invite is a data type for API communication.

type InviteIter added in v0.8.0

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

InviteIter Iterates over a result set of Invites.

func (*InviteIter) Close added in v0.8.0

func (i *InviteIter) Close()

Close closes the InviteIter and releases any associated resources. After Close, any calls to Current will return an error.

func (*InviteIter) Current added in v0.8.0

func (i *InviteIter) Current() (*Invite, error)

Current returns the current Invite, and an optional error. Once an error has been returned, the InviteIter is closed, or the end of iteration is reached, subsequent calls to Current will return an error.

func (*InviteIter) Next added in v0.8.0

func (i *InviteIter) Next() bool

Next advances the InviteIter and returns a boolean indicating if the end has been reached. Next must be called before the first call to Current. Calls to Current after Next returns false will return an error.

type InvitesClient added in v0.8.0

type InvitesClient endpoint

InvitesClient provides access to the /invites APIs

func (*InvitesClient) Create added in v0.8.0

func (c *InvitesClient) Create(ctx context.Context, createInvite *CreateInvite) (*Invite, error)

Create corresponds to the POST /invites endpoint.

Create a new invite

func (*InvitesClient) CreateAccept added in v0.8.0

func (c *InvitesClient) CreateAccept(ctx context.Context, acceptInvite *AcceptInvite) error

CreateAccept corresponds to the POST /invites/accept endpoint.

Accept an invite

func (*InvitesClient) Delete added in v0.8.0

func (c *InvitesClient) Delete(ctx context.Context, id ID) error

Delete corresponds to the DELETE /invites/:id/ endpoint.

Revoke an existing invite

func (*InvitesClient) Get added in v0.8.0

func (c *InvitesClient) Get(ctx context.Context, token string) (*PublicInvite, error)

Get corresponds to the GET /invites/:token/ endpoint.

Retrieve an invite's details by token

func (*InvitesClient) List added in v0.8.0

func (c *InvitesClient) List(ctx context.Context, teamID ID) *InviteIter

List corresponds to the GET /invites endpoint.

List of invites for the user

type Label

type Label string

Label represents any object's label field

func (Label) Validate

func (lbl Label) Validate(_ interface{}) error

Validate ensures the label value is valid

type LoginPublicKey added in v0.8.0

type LoginPublicKey struct {
	Salt  string `json:"salt"`
	Value string `json:"value"`
	Alg   string `json:"alg"`
}

LoginPublicKey is a data type for API communication.

type LoginTokenRequest added in v0.8.0

type LoginTokenRequest struct {
	Email string `json:"email"`
}

LoginTokenRequest is a data type for API communication.

type LoginTokenResponse added in v0.8.0

type LoginTokenResponse struct {
	Token string `json:"token"`
	Salt  string `json:"salt"`
}

LoginTokenResponse is a data type for API communication.

type MarketplaceClient added in v0.8.0

type MarketplaceClient struct {
	Credentials *CredentialsClient
	Internal    *InternalClient
	Projects    *ProjectsClient
	Resources   *ResourcesClient
	// contains filtered or unexported fields
}

MarketplaceClient is an API client for all endpoints.

func NewMarketplace added in v0.8.0

func NewMarketplace() *MarketplaceClient

NewMarketplace returns a new MarketplaceClient with the default configuration.

type MemberProfile added in v0.8.0

type MemberProfile struct {
	UserID       ID     `json:"user_id"`
	MembershipID ID     `json:"membership_id"`
	Email        string `json:"email"`
	Name         string `json:"name"`
	Role         string `json:"role"`
}

MemberProfile is a data type for API communication.

type MemberProfileIter added in v0.8.0

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

MemberProfileIter Iterates over a result set of MemberProfiles.

func (*MemberProfileIter) Close added in v0.8.0

func (i *MemberProfileIter) Close()

Close closes the MemberProfileIter and releases any associated resources. After Close, any calls to Current will return an error.

func (*MemberProfileIter) Current added in v0.8.0

func (i *MemberProfileIter) Current() (*MemberProfile, error)

Current returns the current MemberProfile, and an optional error. Once an error has been returned, the MemberProfileIter is closed, or the end of iteration is reached, subsequent calls to Current will return an error.

func (*MemberProfileIter) Next added in v0.8.0

func (i *MemberProfileIter) Next() bool

Next advances the MemberProfileIter and returns a boolean indicating if the end has been reached. Next must be called before the first call to Current. Calls to Current after Next returns false will return an error.

type MembershipsClient added in v0.8.0

type MembershipsClient endpoint

MembershipsClient provides access to the /memberships APIs

func (*MembershipsClient) Delete added in v0.8.0

func (c *MembershipsClient) Delete(ctx context.Context, id ID) error

Delete corresponds to the DELETE /memberships/:id endpoint.

Remove a member from a team

func (*MembershipsClient) List added in v0.8.0

List corresponds to the GET /memberships endpoint.

List memberships for the user

type Metadata added in v0.9.5

type Metadata map[string]MetadataValue

Metadata stores Metadata for a Manifold resource

func (Metadata) Equals added in v0.9.5

func (m Metadata) Equals(md Metadata) bool

Equals checks the equality of another Metadata against this one

func (Metadata) GetBool added in v0.9.5

func (m Metadata) GetBool(key string) (*bool, error)

GetBool returns the value of the specified key as a bool, or returns an error

func (Metadata) GetFloat added in v0.9.5

func (m Metadata) GetFloat(key string) (*float64, error)

GetFloat returns the value of the specified key as a float64, or returns an error

func (Metadata) GetInt added in v0.9.5

func (m Metadata) GetInt(key string) (*int64, error)

GetInt returns the value of the specified key as a int64, or returns an error

func (Metadata) GetObject added in v0.9.5

func (m Metadata) GetObject(key string) (Metadata, error)

GetObject returns the value of the specified key as a Metadata, or returns an error

func (Metadata) GetString added in v0.9.5

func (m Metadata) GetString(key string) (*string, error)

GetString returns the value of the specified key as a string, or returns an error

func (Metadata) Validate added in v0.9.5

func (m Metadata) Validate(_ interface{}) error

Validate validates this Metadata

type MetadataValue added in v0.9.5

type MetadataValue struct {
	Type  MetadataValueType `json:"type"`
	Value interface{}       `json:"value"`
}

MetadataValue stores MetadataValue for a Manifold resource

func (*MetadataValue) Equals added in v0.9.5

func (m *MetadataValue) Equals(md MetadataValue) bool

Equals checks the equality of another MetadataValue against this one

func (*MetadataValue) FromMap added in v0.9.5

func (m *MetadataValue) FromMap(md map[string]interface{}) error

FromMap tries to make a MetadataValue from a supplied map

func (*MetadataValue) UnmarshalJSON added in v0.9.5

func (m *MetadataValue) UnmarshalJSON(data []byte) error

UnmarshalJSON controls how a MetadataValue is parsed from JSON

func (*MetadataValue) Validate added in v0.9.5

func (m *MetadataValue) Validate(_ interface{}) error

Validate validates this MetadataValue

type MetadataValueType added in v0.9.5

type MetadataValueType string

MetadataValueType defines metadata type identifiers

const (
	// MetadataValueTypeString identifies the string type
	MetadataValueTypeString MetadataValueType = "string"
	// MetadataValueTypeBool identifies the bool type
	MetadataValueTypeBool MetadataValueType = "bool"
	// MetadataValueTypeInt identifies the int type
	MetadataValueTypeInt MetadataValueType = "int"
	// MetadataValueTypeFloat identifies the float type
	MetadataValueTypeFloat MetadataValueType = "float"
	// MetadataValueTypeObject identifies the object type
	MetadataValueTypeObject MetadataValueType = "object"
)

type Mutable

type Mutable interface {
	Identifiable
	Mutable() // also just for type checking.
}

Mutable structs are Identifiables that can be changed.

type Name

type Name string

Name represents any object's name field

func (Name) Validate

func (n Name) Validate(_ interface{}) error

Validate ensures the name value is valid

type Plan added in v0.8.0

type Plan struct {
	ID      ID       `json:"id"`
	Version int      `json:"version"`
	Type    string   `json:"type"`
	Body    PlanBody `json:"body"`
}

Plan is a data type for API communication.

type PlanBody added in v0.8.0

type PlanBody struct {
	ProviderID ID             `json:"provider_id"`
	ProductID  ID             `json:"product_id"`
	Name       string         `json:"name"`
	Label      string         `json:"label"`
	State      string         `json:"state"`
	Regions    []ID           `json:"regions"`  // Array of Region IDs
	Features   []FeatureValue `json:"features"` // Array of Feature Values

	// The number of days a user gets as a free trial when subscribing to
	// this plan. Trials are valid only once per product; changing plans
	// or adding an additional subscription will not start a new trial.
	TrialDays *int `json:"trial_days"`
	Cost      int  `json:"cost"` // Dollar value in cents
}

PlanBody is a data type for API communication.

type PlanIter added in v0.8.0

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

PlanIter Iterates over a result set of Plans.

func (*PlanIter) Close added in v0.8.0

func (i *PlanIter) Close()

Close closes the PlanIter and releases any associated resources. After Close, any calls to Current will return an error.

func (*PlanIter) Current added in v0.8.0

func (i *PlanIter) Current() (*Plan, error)

Current returns the current Plan, and an optional error. Once an error has been returned, the PlanIter is closed, or the end of iteration is reached, subsequent calls to Current will return an error.

func (*PlanIter) Next added in v0.8.0

func (i *PlanIter) Next() bool

Next advances the PlanIter and returns a boolean indicating if the end has been reached. Next must be called before the first call to Current. Calls to Current after Next returns false will return an error.

type PlansClient added in v0.8.0

type PlansClient endpoint

PlansClient provides access to the /plans APIs

func (*PlansClient) Create added in v0.8.0

func (c *PlansClient) Create(ctx context.Context, createPlan *CreatePlan) (*Plan, error)

Create corresponds to the POST /plans/ endpoint.

Add a new plan

func (*PlansClient) Get added in v0.8.0

func (c *PlansClient) Get(ctx context.Context, id ID) (*Plan, error)

Get corresponds to the GET /plans/:id endpoint.

Get a plan by ID

func (*PlansClient) List added in v0.8.0

func (c *PlansClient) List(ctx context.Context, productID []ID, opts *PlansListOpts) *PlanIter

List corresponds to the GET /plans/ endpoint.

Get a list of plans.

type PlansListOpts added in v0.8.9

type PlansListOpts struct {
	Label *string `json:"label"` // Filter results to only include those that have this label.
}

PlansListOpts holds optional argument values

type Product added in v0.8.0

type Product struct {
	ID      ID          `json:"id"`
	Version int         `json:"version"`
	Type    string      `json:"type"`
	Body    ProductBody `json:"body"`
}

Product is a data type for API communication.

type ProductBody added in v0.8.0

type ProductBody struct {
	ProviderID       ID          `json:"provider_id"`
	Label            string      `json:"label"`
	Name             string      `json:"name"`
	State            string      `json:"state"`
	LogoURL          string      `json:"logo_url"`
	Tagline          string      `json:"tagline"`     // 140 character sentence positioning the product.
	ValueProps       []ValueProp `json:"value_props"` // A list of value propositions of the product.
	Images           []string    `json:"images"`
	SupportEmail     string      `json:"support_email"`
	DocumentationURL string      `json:"documentation_url"`

	// URL to this Product's Terms of Service. If provided is true, then
	// a url must be set. Otherwise, provided is false.
	Terms        ProductBodyTerms       `json:"terms"`
	FeatureTypes []FeatureType          `json:"feature_types"`
	Billing      ProductBodyBilling     `json:"billing"`
	Integration  ProductBodyIntegration `json:"integration"`
}

ProductBody is a data type for API communication.

type ProductBodyBilling added in v0.8.0

type ProductBodyBilling struct {
	Type     string `json:"type"`
	Currency string `json:"currency"`
}

ProductBodyBilling is a data type for API communication.

type ProductBodyIntegration added in v0.8.0

type ProductBodyIntegration struct {
	BaseURL  string                         `json:"base_url"`
	SSOURL   string                         `json:"sso_url"`
	Version  string                         `json:"version"`
	Features ProductBodyIntegrationFeatures `json:"features"`
}

ProductBodyIntegration is a data type for API communication.

type ProductBodyIntegrationFeatures added in v0.8.0

type ProductBodyIntegrationFeatures struct {
	SSO bool `json:"sso"` // Represents whether or not this product supports Single Sign On

	// Represents whether or not this product supports changing
	// the plan of a resource.
	PlanChange *bool `json:"plan_change"`

	// Describes how the region for a resource is specified, if
	// unspecified, then regions have no impact on this
	// resource.
	Region *string `json:"region"`
}

ProductBodyIntegrationFeatures is a data type for API communication.

type ProductBodyTerms added in v0.8.0

type ProductBodyTerms struct {
	URL      string `json:"url"`
	Provided bool   `json:"provided"`
}

ProductBodyTerms is a data type for API communication.

type ProductIter added in v0.8.0

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

ProductIter Iterates over a result set of Products.

func (*ProductIter) Close added in v0.8.0

func (i *ProductIter) Close()

Close closes the ProductIter and releases any associated resources. After Close, any calls to Current will return an error.

func (*ProductIter) Current added in v0.8.0

func (i *ProductIter) Current() (*Product, error)

Current returns the current Product, and an optional error. Once an error has been returned, the ProductIter is closed, or the end of iteration is reached, subsequent calls to Current will return an error.

func (*ProductIter) Next added in v0.8.0

func (i *ProductIter) Next() bool

Next advances the ProductIter and returns a boolean indicating if the end has been reached. Next must be called before the first call to Current. Calls to Current after Next returns false will return an error.

type ProductsClient added in v0.8.0

type ProductsClient endpoint

ProductsClient provides access to the /products APIs

func (*ProductsClient) Create added in v0.8.0

func (c *ProductsClient) Create(ctx context.Context, createProduct *CreateProduct) (*Product, error)

Create corresponds to the POST /products/ endpoint.

Add a new product

func (*ProductsClient) Get added in v0.8.0

func (c *ProductsClient) Get(ctx context.Context, id ID) (*Product, error)

Get corresponds to the GET /products/:id endpoint.

Get a product by ID

func (*ProductsClient) List added in v0.8.0

List corresponds to the GET /products/ endpoint.

List all available products

type ProductsListOpts added in v0.8.0

type ProductsListOpts struct {
	// Base32 encoded 18 byte identifier of the provider that these
	// products must belong to.
	ProviderID *ID     `json:"provider_id"`
	Label      *string `json:"label"` // Filter results to only include those that have this label.
}

ProductsListOpts holds optional argument values

type Project added in v0.8.0

type Project struct {
	ID      ID     `json:"id"`
	Type    string `json:"type"`
	Version int    `json:"version"`

	Body struct {
		UserID      *ID     `json:"user_id"` // Optional
		TeamID      *ID     `json:"team_id"` // Optional
		Name        string  `json:"name"`
		Label       string  `json:"label"`
		Description *string `json:"description"` // Optional
	} `json:"body"`
}

Project is a data type for API communication.

type ProjectIter added in v0.8.0

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

ProjectIter Iterates over a result set of Projects.

func (*ProjectIter) Close added in v0.8.0

func (i *ProjectIter) Close()

Close closes the ProjectIter and releases any associated resources. After Close, any calls to Current will return an error.

func (*ProjectIter) Current added in v0.8.0

func (i *ProjectIter) Current() (*Project, error)

Current returns the current Project, and an optional error. Once an error has been returned, the ProjectIter is closed, or the end of iteration is reached, subsequent calls to Current will return an error.

func (*ProjectIter) Next added in v0.8.0

func (i *ProjectIter) Next() bool

Next advances the ProjectIter and returns a boolean indicating if the end has been reached. Next must be called before the first call to Current. Calls to Current after Next returns false will return an error.

type ProjectsClient added in v0.8.0

type ProjectsClient endpoint

ProjectsClient provides access to the /projects APIs

func (*ProjectsClient) Create added in v0.8.0

func (c *ProjectsClient) Create(ctx context.Context, createProject *CreateProject) (*Project, error)

Create corresponds to the POST /projects endpoint.

Create a new project

func (*ProjectsClient) Get added in v0.8.0

func (c *ProjectsClient) Get(ctx context.Context, id ID) (*Project, error)

Get corresponds to the GET /projects/:id endpoint.

Retrieve a project by its ID

func (*ProjectsClient) List added in v0.8.0

List corresponds to the GET /projects endpoint.

List all provisioned projects

func (*ProjectsClient) Update added in v0.8.0

func (c *ProjectsClient) Update(ctx context.Context, id ID, publicUpdateProject *PublicUpdateProject) (*Project, error)

Update corresponds to the PATCH /projects/:id endpoint.

Update a project's name or description.

type ProjectsListOpts added in v0.8.0

type ProjectsListOpts struct {
	Me *bool `json:"me"` // Only list projects with the user as the owner

	// ID of the Team to filter projects by, stored as a
	// base32 encoded 18 byte identifier.
	TeamID *ID     `json:"team_id"`
	Label  *string `json:"label"` // Filter projects by a label, returns one or zero results.
}

ProjectsListOpts holds optional argument values

type Provider added in v0.8.0

type Provider struct {
	ID      ID           `json:"id"`
	Version int          `json:"version"`
	Type    string       `json:"type"`
	Body    ProviderBody `json:"body"`
}

Provider is a data type for API communication.

type ProviderBody added in v0.8.0

type ProviderBody struct {
	TeamID           ID      `json:"team_id"`
	Label            string  `json:"label"`
	Name             string  `json:"name"`
	LogoURL          *string `json:"logo_url"`          // Optional
	SupportEmail     *string `json:"support_email"`     // Optional
	DocumentationURL *string `json:"documentation_url"` // Optional
}

ProviderBody is a data type for API communication.

type ProviderIter added in v0.8.0

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

ProviderIter Iterates over a result set of Providers.

func (*ProviderIter) Close added in v0.8.0

func (i *ProviderIter) Close()

Close closes the ProviderIter and releases any associated resources. After Close, any calls to Current will return an error.

func (*ProviderIter) Current added in v0.8.0

func (i *ProviderIter) Current() (*Provider, error)

Current returns the current Provider, and an optional error. Once an error has been returned, the ProviderIter is closed, or the end of iteration is reached, subsequent calls to Current will return an error.

func (*ProviderIter) Next added in v0.8.0

func (i *ProviderIter) Next() bool

Next advances the ProviderIter and returns a boolean indicating if the end has been reached. Next must be called before the first call to Current. Calls to Current after Next returns false will return an error.

type ProvidersClient added in v0.8.0

type ProvidersClient endpoint

ProvidersClient provides access to the /providers APIs

func (*ProvidersClient) Create added in v0.8.0

func (c *ProvidersClient) Create(ctx context.Context, createProvider *CreateProvider) (*Provider, error)

Create corresponds to the POST /providers/ endpoint.

Add a new provider

func (*ProvidersClient) Get added in v0.8.0

func (c *ProvidersClient) Get(ctx context.Context, id ID) (*Provider, error)

Get corresponds to the GET /providers/:id endpoint.

Get a provider by ID

func (*ProvidersClient) List added in v0.8.0

List corresponds to the GET /providers/ endpoint.

List all available providers

type ProvidersListOpts added in v0.8.9

type ProvidersListOpts struct {
	Label *string `json:"label"` // Filter results to only include those that have this label.
}

ProvidersListOpts holds optional argument values

type PublicInvite added in v0.8.0

type PublicInvite struct {
	Team Team   `json:"team"`
	Role string `json:"role"`

	Invited struct {
		Name  *string `json:"name"`  // Optional
		Email *string `json:"email"` // Optional
	} `json:"invited"`

	InvitedBy struct {
		Name  *string `json:"name"`  // Optional
		Email *string `json:"email"` // Optional
	} `json:"invited_by"`
}

PublicInvite is a data type for API communication.

type PublicUpdateProject added in v0.8.0

type PublicUpdateProject struct {
	Body PublicUpdateProjectBody `json:"body"`
}

PublicUpdateProject is a data type for API communication. Update project patch request

type PublicUpdateProjectBody added in v0.8.0

type PublicUpdateProjectBody struct {
	Name        *string `json:"name"`        // Optional
	Label       *string `json:"label"`       // Optional
	Description *string `json:"description"` // Optional
}

PublicUpdateProjectBody is a data type for API communication.

type PublicUpdateResource added in v0.8.0

type PublicUpdateResource struct {
	Body PublicUpdateResourceBody `json:"body"`
}

PublicUpdateResource is a data type for API communication. Shape of request used to update a resource through a public api

type PublicUpdateResourceBody added in v0.8.0

type PublicUpdateResourceBody struct {
	Name  *string `json:"name"`  // Optional
	Label *string `json:"label"` // Optional
}

PublicUpdateResourceBody is a data type for API communication.

type Region added in v0.8.0

type Region struct {
	ID      ID         `json:"id"`
	Type    string     `json:"type"`
	Version int        `json:"version"`
	Body    RegionBody `json:"body"`
}

Region is a data type for API communication.

type RegionBody added in v0.8.0

type RegionBody struct {
	Platform string  `json:"platform"`
	Location string  `json:"location"`
	Name     string  `json:"name"`
	Priority float64 `json:"priority"`
}

RegionBody is a data type for API communication.

type RegionIter added in v0.8.0

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

RegionIter Iterates over a result set of Regions.

func (*RegionIter) Close added in v0.8.0

func (i *RegionIter) Close()

Close closes the RegionIter and releases any associated resources. After Close, any calls to Current will return an error.

func (*RegionIter) Current added in v0.8.0

func (i *RegionIter) Current() (*Region, error)

Current returns the current Region, and an optional error. Once an error has been returned, the RegionIter is closed, or the end of iteration is reached, subsequent calls to Current will return an error.

func (*RegionIter) Next added in v0.8.0

func (i *RegionIter) Next() bool

Next advances the RegionIter and returns a boolean indicating if the end has been reached. Next must be called before the first call to Current. Calls to Current after Next returns false will return an error.

type RegionsClient added in v0.8.0

type RegionsClient endpoint

RegionsClient provides access to the /regions APIs

func (*RegionsClient) Create added in v0.8.0

func (c *RegionsClient) Create(ctx context.Context, createRegion *CreateRegion) (*Region, error)

Create corresponds to the POST /regions/ endpoint.

Add a new region

func (*RegionsClient) Get added in v0.8.0

func (c *RegionsClient) Get(ctx context.Context, id ID) (*Region, error)

Get corresponds to the GET /regions/:id endpoint.

Get a Region by ID

func (*RegionsClient) List added in v0.8.0

List corresponds to the GET /regions/ endpoint.

List all available regions

type RegionsListOpts added in v0.8.0

type RegionsListOpts struct {
	Location *string `json:"location"` // Filter results to only include the regions that have this location.
	Platform *string `json:"platform"` // Filter results to only include the regions that are on this platform.
}

RegionsListOpts holds optional argument values

type Resource added in v0.8.0

type Resource struct {
	ID      ID     `json:"id"`
	Type    string `json:"type"`
	Version int    `json:"version"`

	Body struct {
		Name      string `json:"name"`
		Label     string `json:"label"`
		UserID    *ID    `json:"user_id"`    // Optional
		TeamID    *ID    `json:"team_id"`    // Optional
		ProductID *ID    `json:"product_id"` // Optional
		PlanID    *ID    `json:"plan_id"`    // Optional
		RegionID  *ID    `json:"region_id"`  // Optional
		ProjectID *ID    `json:"project_id"` // Optional
		Source    string `json:"source"`
		CreatedAt string `json:"created_at"`
		UpdatedAt string `json:"updated_at"`
	} `json:"body"`
}

Resource is a data type for API communication.

type ResourceIter added in v0.8.0

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

ResourceIter Iterates over a result set of Resources.

func (*ResourceIter) Close added in v0.8.0

func (i *ResourceIter) Close()

Close closes the ResourceIter and releases any associated resources. After Close, any calls to Current will return an error.

func (*ResourceIter) Current added in v0.8.0

func (i *ResourceIter) Current() (*Resource, error)

Current returns the current Resource, and an optional error. Once an error has been returned, the ResourceIter is closed, or the end of iteration is reached, subsequent calls to Current will return an error.

func (*ResourceIter) Next added in v0.8.0

func (i *ResourceIter) Next() bool

Next advances the ResourceIter and returns a boolean indicating if the end has been reached. Next must be called before the first call to Current. Calls to Current after Next returns false will return an error.

type ResourcesClient added in v0.8.0

type ResourcesClient endpoint

ResourcesClient provides access to the /resources APIs

func (*ResourcesClient) Get added in v0.8.0

func (c *ResourcesClient) Get(ctx context.Context, id ID) (*Resource, error)

Get corresponds to the GET /resources/:id endpoint.

Retrieve a resource

func (*ResourcesClient) GetConfig added in v0.8.0

func (c *ResourcesClient) GetConfig(ctx context.Context, id ID) (*map[string]string, error)

GetConfig corresponds to the GET /resources/:id/config endpoint.

Get the custom config for a resource Get the custom config for a resource. Only resources with a `source` of `custom` have custom configs. Requesting the custom config for a resource of any other source will result in a `400` response.

func (*ResourcesClient) List added in v0.8.0

List corresponds to the GET /resources/ endpoint.

List all provisioned resources

func (*ResourcesClient) Update added in v0.8.0

func (c *ResourcesClient) Update(ctx context.Context, id ID, publicUpdateResource *PublicUpdateResource) (*Resource, error)

Update corresponds to the PATCH /resources/:id endpoint.

Update a resource name or other property that doesn't require communication with the provider.

func (*ResourcesClient) UpdateConfig added in v0.8.0

func (c *ResourcesClient) UpdateConfig(ctx context.Context, id ID, configPatch *map[string]interface{}) (*map[string]string, error)

UpdateConfig corresponds to the PATCH /resources/:id/config endpoint.

Modify the custom config for a resource Modify the custom config for a resource. Only resources with a `source` of `custom` have custom configs. Attempting to modify the custom config for a resource of any other source will result in a `400` response.

Custom config is modified via JSON merge patching. To change or modify a key, include that key with the new value. To remove a key, include that key in the request with a null value. Any keys not included in the request are ignored and left unchanged.

type ResourcesListOpts added in v0.8.0

type ResourcesListOpts struct {
	// ID of the Team to filter Resources by, stored as a
	// base32 encoded 18 byte identifier.
	TeamID *ID `json:"team_id"`

	// ID of the Product to filter Resources by, stored as a
	// base32 encoded 18 byte identifier.
	ProductID *ID `json:"product_id"`

	// ID of the Project to filter Resources by, stored as a
	// base32 encoded 18 byte identifier.
	ProjectID *ID     `json:"project_id"`
	Label     *string `json:"label"` // Filter resources by a label, returns one or zero results.
}

ResourcesListOpts holds optional argument values

type SelfClient added in v0.8.0

type SelfClient endpoint

SelfClient provides access to the /self APIs

func (*SelfClient) Get added in v0.8.0

func (c *SelfClient) Get(ctx context.Context) (*User, error)

Get corresponds to the GET /self endpoint.

Retrieve the underlying user represented by a Token

type Team added in v0.8.0

type Team struct {
	ID      ID     `json:"id"`
	Type    string `json:"type"`
	Version int    `json:"version"`

	Body struct {
		Name  string `json:"name"`
		Label string `json:"label"`
	} `json:"body"`
}

Team is a data type for API communication.

type TeamIter added in v0.8.0

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

TeamIter Iterates over a result set of Teams.

func (*TeamIter) Close added in v0.8.0

func (i *TeamIter) Close()

Close closes the TeamIter and releases any associated resources. After Close, any calls to Current will return an error.

func (*TeamIter) Current added in v0.8.0

func (i *TeamIter) Current() (*Team, error)

Current returns the current Team, and an optional error. Once an error has been returned, the TeamIter is closed, or the end of iteration is reached, subsequent calls to Current will return an error.

func (*TeamIter) Next added in v0.8.0

func (i *TeamIter) Next() bool

Next advances the TeamIter and returns a boolean indicating if the end has been reached. Next must be called before the first call to Current. Calls to Current after Next returns false will return an error.

type TeamMembership added in v0.8.0

type TeamMembership struct {
	ID      ID     `json:"id"`
	Type    string `json:"type"`
	Version int    `json:"version"`

	Body struct {
		UserID ID     `json:"user_id"`
		TeamID ID     `json:"team_id"`
		Role   string `json:"role"`
	} `json:"body"`
}

TeamMembership is a data type for API communication.

type TeamMembershipIter added in v0.8.0

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

TeamMembershipIter Iterates over a result set of TeamMemberships.

func (*TeamMembershipIter) Close added in v0.8.0

func (i *TeamMembershipIter) Close()

Close closes the TeamMembershipIter and releases any associated resources. After Close, any calls to Current will return an error.

func (*TeamMembershipIter) Current added in v0.8.0

func (i *TeamMembershipIter) Current() (*TeamMembership, error)

Current returns the current TeamMembership, and an optional error. Once an error has been returned, the TeamMembershipIter is closed, or the end of iteration is reached, subsequent calls to Current will return an error.

func (*TeamMembershipIter) Next added in v0.8.0

func (i *TeamMembershipIter) Next() bool

Next advances the TeamMembershipIter and returns a boolean indicating if the end has been reached. Next must be called before the first call to Current. Calls to Current after Next returns false will return an error.

type TeamsClient added in v0.8.0

type TeamsClient endpoint

TeamsClient provides access to the /teams APIs

func (*TeamsClient) Create added in v0.8.0

func (c *TeamsClient) Create(ctx context.Context, createTeam *CreateTeam) (*Team, error)

Create corresponds to the POST /teams endpoint.

Create a new team

func (*TeamsClient) Get added in v0.8.0

func (c *TeamsClient) Get(ctx context.Context, id ID) (*Team, error)

Get corresponds to the GET /teams/:id endpoint.

Get a single team's profile

func (*TeamsClient) List added in v0.8.0

func (c *TeamsClient) List(ctx context.Context) *TeamIter

List corresponds to the GET /teams endpoint.

List teams for the current authenticated user

func (*TeamsClient) ListMembers added in v0.8.0

func (c *TeamsClient) ListMembers(ctx context.Context, id ID) *MemberProfileIter

ListMembers corresponds to the GET /teams/:id/members endpoint.

Get team members by team id

func (*TeamsClient) Update added in v0.8.0

func (c *TeamsClient) Update(ctx context.Context, id ID, updateTeam *UpdateTeam) (*Team, error)

Update corresponds to the PATCH /teams/:id endpoint.

Update team profile

type TokensClient added in v0.8.0

type TokensClient endpoint

TokensClient provides access to the /tokens APIs

func (*TokensClient) Create added in v0.8.5

func (c *TokensClient) Create(ctx context.Context, apitokenRequest *APITokenRequest) (*APIToken, error)

Create corresponds to the POST /tokens endpoint.

Create a new api token

func (*TokensClient) CreateAuth added in v0.8.0

func (c *TokensClient) CreateAuth(ctx context.Context, authorization string, authTokenRequest *AuthTokenRequest) (*AuthToken, error)

CreateAuth corresponds to the POST /tokens/auth endpoint.

Exchange a login token for a general use auth token

func (*TokensClient) CreateLogin added in v0.8.0

func (c *TokensClient) CreateLogin(ctx context.Context, loginTokenRequest *LoginTokenRequest) (*LoginTokenResponse, error)

CreateLogin corresponds to the POST /tokens/login endpoint.

Create a new login token

func (*TokensClient) Delete added in v0.8.0

func (c *TokensClient) Delete(ctx context.Context, token string) error

Delete corresponds to the DELETE /tokens/:token endpoint.

Revoke an auth token for log out

func (*TokensClient) List added in v0.8.5

func (c *TokensClient) List(ctx context.Context, tokensType string, opts *TokensListOpts) *APITokenIter

List corresponds to the GET /tokens endpoint.

List API tokens

type TokensListOpts added in v0.8.5

type TokensListOpts struct {
	Me *bool `json:"me"` // Only list tokens with the user as the owner

	// ID of the Team to filter tokens by, stored as a
	// base32 encoded 18 byte identifier.
	TeamID *ID `json:"team_id"`
}

TokensListOpts holds optional argument values

type UpdateTeam added in v0.8.0

type UpdateTeam struct {
	Body UpdateTeamBody `json:"body"`
}

UpdateTeam is a data type for API communication.

type UpdateTeamBody added in v0.8.0

type UpdateTeamBody struct {
	Name  string `json:"name"`
	Label string `json:"label"`
}

UpdateTeamBody is a data type for API communication.

type UpdateUser added in v0.8.0

type UpdateUser struct {
	Body *UpdateUserBody `json:"body"` // Optional
}

UpdateUser is a data type for API communication.

type UpdateUserBody added in v0.8.0

type UpdateUserBody struct {
	Name         *string         `json:"name"`           // Optional
	Email        *string         `json:"email"`          // Optional
	PublicKey    *LoginPublicKey `json:"public_key"`     // Optional
	AuthTokenSig *string         `json:"auth_token_sig"` // Optional
}

UpdateUserBody is a data type for API communication.

type User added in v0.8.0

type User struct {
	ID      ID     `json:"id"`
	Version int    `json:"version"`
	Type    string `json:"type"`

	Body struct {
		Name             string         `json:"name"`
		Email            string         `json:"email"`
		PublicKey        LoginPublicKey `json:"public_key"`
		VerificationCode *string        `json:"verification_code"` // Optional
		State            string         `json:"state"`
	} `json:"body"`
}

User is a data type for API communication.

type UsersClient added in v0.8.0

type UsersClient endpoint

UsersClient provides access to the /users APIs

func (*UsersClient) Create added in v0.8.0

func (c *UsersClient) Create(ctx context.Context, createUser *CreateUser) (*User, error)

Create corresponds to the POST /users endpoint.

Create a new user

func (*UsersClient) CreateForgotPassword added in v0.8.0

func (c *UsersClient) CreateForgotPassword(ctx context.Context, forgotPassword *ForgotPassword) error

CreateForgotPassword corresponds to the POST /users/forgot-password endpoint.

Reset password with an emailed forgot password token

func (*UsersClient) CreateForgotPasswordToken added in v0.8.0

func (c *UsersClient) CreateForgotPasswordToken(ctx context.Context, forgotPasswordCreate *ForgotPasswordCreate) error

CreateForgotPasswordToken corresponds to the POST /users/forgot-password/token endpoint.

User has forgotten password, send a reset token

func (*UsersClient) CreateVerify added in v0.8.0

func (c *UsersClient) CreateVerify(ctx context.Context, verifyEmail *VerifyEmail) error

CreateVerify corresponds to the POST /users/verify endpoint.

Verify email address

func (*UsersClient) Update added in v0.8.0

func (c *UsersClient) Update(ctx context.Context, id ID, updateUser *UpdateUser) (*User, error)

Update corresponds to the PATCH /users/:id endpoint.

Update user profile

type ValueProp added in v0.8.0

type ValueProp struct {
	Header string `json:"header"` // Heading of a value proposition.
	Body   string `json:"body"`   // Body of a value proposition.
}

ValueProp is a data type for API communication.

type VerifyEmail added in v0.8.0

type VerifyEmail struct {
	Body *VerifyEmailBody `json:"body"` // Optional
}

VerifyEmail is a data type for API communication.

type VerifyEmailBody added in v0.8.0

type VerifyEmailBody struct {
	VerificationCode string `json:"verification_code"`
}

VerifyEmailBody is a data type for API communication.

Directories

Path Synopsis
Package idtype contains our enumeration of all registered types.
Package idtype contains our enumeration of all registered types.
tools

Jump to

Keyboard shortcuts

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