api

package
v0.0.0-...-09899ef Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoIncrementingModel

type AutoIncrementingModel struct {
	ID        uint      `gorm:"primary_key;column:id;default:nextval('accounts_id_seq'::regclass)" json:"id"`
	CreatedAt time.Time `sql:"not null;default:now()" json:"created_at,omitempty"`
	Errors    []*Error  `sql:"-" json:"errors,omitempty"`
}

AutoIncrementingModel base class with int primary key

type Client

type Client struct {
	Host   string
	Path   string
	Scheme string

	Cookie  *string
	Headers map[string][]string
	Token   *string

	Username *string
	Password *string
}

Client is a generic base class for calling a REST API; when a token is configured on an Client instance it will be provided as a bearer authorization header; when a username and password are configured on an Client instance, they will be used for HTTP basic authorization but will be passed as the Authorization header instead of as part of the URL itself. When a token is configured on an Client instance, the username and password supplied for basic auth are currently discarded.

func (*Client) Delete

func (c *Client) Delete(uri string) (status int, response interface{}, err error)

Delete constructs and synchronously sends an API DELETE request

func (*Client) DeleteWithTLSClientConfig

func (c *Client) DeleteWithTLSClientConfig(uri string, tlsClientConfig *tls.Config) (status int, response interface{}, err error)

DeleteWithTLSClientConfig constructs and synchronously sends an API DELETE request

func (*Client) Get

func (c *Client) Get(uri string, params map[string]interface{}) (status int, response interface{}, err error)

Get constructs and synchronously sends an API GET request

func (*Client) GetWithTLSClientConfig

func (c *Client) GetWithTLSClientConfig(uri string, params map[string]interface{}, tlsClientConfig *tls.Config) (status int, response interface{}, err error)

GetWithTLSClientConfig constructs and synchronously sends an API GET request

func (*Client) Head

func (c *Client) Head(uri string, params map[string]interface{}) (status int, response map[string][]string, err error)

Head constructs and synchronously sends an API HEAD request; returns the headers

func (*Client) Patch

func (c *Client) Patch(uri string, params map[string]interface{}) (status int, response interface{}, err error)

Patch constructs and synchronously sends an API PATCH request

func (*Client) PatchWithTLSClientConfig

func (c *Client) PatchWithTLSClientConfig(uri string, params map[string]interface{}, tlsClientConfig *tls.Config) (status int, response interface{}, err error)

PatchWithTLSClientConfig constructs and synchronously sends an API PATCH request

func (*Client) Post

func (c *Client) Post(uri string, params map[string]interface{}) (status int, response interface{}, err error)

Post constructs and synchronously sends an API POST request

func (*Client) PostMultipartFormData

func (c *Client) PostMultipartFormData(uri string, params map[string]interface{}) (status int, response interface{}, err error)

PostMultipartFormData constructs and synchronously sends an API POST request using multipart/form-data as the content-type

func (*Client) PostMultipartFormDataWithTLSClientConfig

func (c *Client) PostMultipartFormDataWithTLSClientConfig(uri string, params map[string]interface{}, tlsClientConfig *tls.Config) (status int, response interface{}, err error)

PostMultipartFormDataWithTLSClientConfig constructs and synchronously sends an API POST request using multipart/form-data as the content-type

func (*Client) PostWWWFormURLEncoded

func (c *Client) PostWWWFormURLEncoded(uri string, params map[string]interface{}) (status int, response interface{}, err error)

PostWWWFormURLEncoded constructs and synchronously sends an API POST request using application/x-www-form-urlencoded as the content-type

func (*Client) PostWWWFormURLEncodedWithTLSClientConfig

func (c *Client) PostWWWFormURLEncodedWithTLSClientConfig(uri string, params map[string]interface{}, tlsClientConfig *tls.Config) (status int, response interface{}, err error)

PostWWWFormURLEncodedWithTLSClientConfig constructs and synchronously sends an API POST request using application/x-www-form-urlencoded as the content-type

func (*Client) PostWithTLSClientConfig

func (c *Client) PostWithTLSClientConfig(uri string, params map[string]interface{}, tlsClientConfig *tls.Config) (status int, response interface{}, err error)

PostWithTLSClientConfig constructs and synchronously sends an API POST request

func (*Client) Put

func (c *Client) Put(uri string, params map[string]interface{}) (status int, response interface{}, err error)

Put constructs and synchronously sends an API PUT request

func (*Client) PutWithTLSClientConfig

func (c *Client) PutWithTLSClientConfig(uri string, params map[string]interface{}, tlsClientConfig *tls.Config) (status int, response interface{}, err error)

PutWithTLSClientConfig constructs and synchronously sends an API PUT request

type Error

type Error struct {
	Message *string `json:"message"`
	Status  *int    `json:"status,omitempty"`
}

Error struct

type IModel

type IModel interface {
	Create() bool
	Reload()
	Update() bool
	Validate() bool
}

IModel interface TODO-- this isn't actually used anywhere... decide if it should be or remove it.

type Manifest

type Manifest struct {
	Name       string             `json:"name"`
	Version    string             `json:"version"`
	Repository string             `json:"repository"`
	Packages   []*ManifestPackage `json:"packages"`
}

Manifest defines the contents of a Provide release

func (*Manifest) GetImageVersion

func (m *Manifest) GetImageVersion(image string) (*string, error)

type ManifestPackage

type ManifestPackage struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Source  string `json:"source"`
	Image   string `json:"docker_image"`
	Type    string `json:"type"`
}

ManifestPackage defines a single Manifest package

type Model

type Model struct {
	ID        uuid.UUID `sql:"primary_key;type:uuid;default:uuid_generate_v4()" json:"id"`
	CreatedAt time.Time `sql:"not null;default:now()" json:"created_at,omitempty"`
	Errors    []*Error  `sql:"-" json:"errors,omitempty"`
}

Model base class with uuid v4 primary key id

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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