api

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: MIT Imports: 6 Imported by: 7

Documentation

Overview

Package api contains definitions for Inertia API requests and responses

Index

Constants

View Source
const (
	// MsgDaemonOK is the OK response upon successfully reaching daemon
	MsgDaemonOK = "I'm a little Webhook, short and stout!"

	// MsgTokenExpired indicates authentication method is expired
	MsgTokenExpired = "token expired"

	// Container is a constant used in HTTP GET query strings
	Container = "container"

	// Stream is a constant used in HTTP GET query strings
	Stream = "stream"

	// Entries is a constant used in HTTP GET query strings
	Entries = "entries"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseResponse added in v0.6.0

type BaseResponse struct {
	// Basic metadata
	HTTPStatusCode int    `json:"code"`
	RequestID      string `json:"request_id,omitempty"`

	// Message is included in all responses, and is a summary of the server's response
	Message string `json:"message"`

	// Err contains additional context in the event of an error
	Err string `json:"error,omitempty"`

	// Data contains information the server wants to return
	Data interface{} `json:"data,omitempty"`
}

BaseResponse is the underlying response structure to all responses.

func Unmarshal added in v0.6.0

func Unmarshal(r io.Reader, kvs ...KV) (*BaseResponse, error)

Unmarshal reads the response and unmarshalls the BaseResponse as well any requested key-value pairs. For example:

	  var totpResp = &api.TotpResponse{}
   api.Unmarshal(resp.Body, api.KV{Key: "totp", Value: totpResp})

Values provided in KV.Value MUST be explicit pointers, even if the value is a pointer type, ie maps and slices.

func (*BaseResponse) Error added in v0.6.0

func (b *BaseResponse) Error() error

Error returns a summary of an encountered error. For more details, you may want to interrogate Data. Returns nil if StatusCode is not an HTTP error code, ie if the code is in 1xx, 2xx, or 3xx

type DeploymentStatus

type DeploymentStatus struct {
	InertiaVersion       string   `json:"version"`
	Branch               string   `json:"branch"`
	CommitHash           string   `json:"commit_hash"`
	CommitMessage        string   `json:"commit_message"`
	BuildType            string   `json:"build_type"`
	Containers           []string `json:"containers"`
	BuildContainerActive bool     `json:"build_active"`

	// returns tag of latest version on dockerhub
	NewVersionAvailable *string `json:"new_version_available"`
}

DeploymentStatus lists details about the deployed project

type EnvRequest

type EnvRequest struct {
	Name    string `json:"name,omitempty"`
	Value   string `json:"value,omitempty"`
	Encrypt bool   `json:"encrypt,omitempty"`

	Remove bool `json:"remove,omitempty"`
}

EnvRequest represents a request to manage environment variables

type GitOptions

type GitOptions struct {
	RemoteURL string `json:"remote"`
	Branch    string `json:"branch"`
}

GitOptions represents GitHub-related deployment options

type KV added in v0.6.0

type KV struct {
	Key   string
	Value interface{}
}

KV is used for defining specific values to be unmarshalled from BaseResponse data

type TotpResponse

type TotpResponse struct {
	TotpSecret  string   `json:"secret"`
	BackupCodes []string `json:"backup_codes"`
}

TotpResponse is used for sending users their Totp secret and backup codes

type UpRequest

type UpRequest struct {
	Stream                 bool       `json:"stream"`
	Project                string     `json:"project"`
	BuildType              string     `json:"build_type"`
	BuildFilePath          string     `json:"build_file_path"`
	GitOptions             GitOptions `json:"git_options"`
	WebHookSecret          string     `json:"webhook_secret"`
	IntermediaryContainers []string   `json:"intermediary_containers"`
	SlackNotificationURL   string     `json:"slack_notification_url"`
}

UpRequest is the configurable body of a UP request to the daemon. TODO: unify with configuration definitions

type UserRequest

type UserRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Email    string `json:"email"`
	Admin    bool   `json:"admin"`
	Totp     string `json:"totp"`
}

UserRequest is used for logging in or modifying users

Jump to

Keyboard shortcuts

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