models

package
v5.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Image

type Image struct {
	ID         int       `jsonapi:"primary,images"`
	BackedUpAt time.Time `jsonapi:"attr,backed_up_at,iso8601"`
	Ready      bool      `jsonapi:"attr,ready"`
	Anon       string
	CreatedAt  time.Time `jsonapi:"attr,created_at,iso8601"`
	UpdatedAt  time.Time `jsonapi:"attr,updated_at,iso8601"`
}

func NewImage

func NewImage(backedUpAt time.Time, anon string) Image

type Instance

type Instance struct {
	ID           int    `jsonapi:"primary,instances"`
	Hostname     string `jsonapi:"attr,hostname"`
	ImageID      int    `jsonapi:"attr,image_id"`
	UserEmail    string
	RefreshToken string
	CreatedAt    time.Time `jsonapi:"attr,created_at,iso8601"`
	UpdatedAt    time.Time `jsonapi:"attr,updated_at,iso8601"`
	Port         uint16    `jsonapi:"attr,port"`

	Credentials *InstanceCredentials `jsonapi:"relation,credentials"`
}

func NewInstance

func NewInstance(imageID int, email, refreshToken string) Instance

type InstanceCredentials

type InstanceCredentials struct {
	// The JSON:API spec says that we should have an ID field, even though we'll
	// just be setting it to the same value as the instance ID.
	// It would be nice to have this struct as an embedded object, rather than a relation, but that's not possible due to these issues:
	// https://github.com/google/jsonapi/issues/74
	// https://github.com/google/jsonapi/issues/117
	ID                int    `jsonapi:"primary,credentials"`
	CACertificate     string `jsonapi:"attr,ca_certificate"`
	ClientCertificate string `jsonapi:"attr,client_certificate"`
	ClientKey         string `jsonapi:"attr,client_key"`
}

func NewInstanceCredentials

func NewInstanceCredentials(id int, caCert string, clientCert string, clientKey string) InstanceCredentials

type WhitelistedAddress

type WhitelistedAddress struct {
	// Given that we're not serving this model via JSON:API, we don't need a
	// surrogate key (e.g. 'ID'). The IP address and instance ID are used as a composite key.
	IPAddress string
	Instance  *Instance
	CreatedAt time.Time
	UpdatedAt time.Time
}

func NewWhitelistedAddress

func NewWhitelistedAddress(ipaddress string, instance *Instance) WhitelistedAddress

Jump to

Keyboard shortcuts

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