goforge

package
v0.0.0-...-2d49025 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// Base URL for API requests.
	BaseURL *url.URL

	// User agent for client
	UserAgent string
	// contains filtered or unexported fields
}

Client enables communication with the Laravel Forge API

func NewClient

func NewClient(httpClient *http.Client) (*Client, error)

NewClient returns a new API client.

func (*Client) CreateServer

func (c *Client) CreateServer(server Server) (*Server, error)

func (*Client) DeleteServer

func (c *Client) DeleteServer(id int) error

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

Do performs a request and returns the response

func (*Client) DoJSON

func (c *Client) DoJSON(req *http.Request, v interface{}) (*http.Response, error)

DoJSON performs a request and returns the response

func (*Client) DoJSONRequest

func (c *Client) DoJSONRequest(method string, path string, body interface{}, v interface{}) (*http.Response, error)

DoJSONRequest is a convenience method

func (*Client) GetCredentialByID

func (c *Client) GetCredentialByID(id int) (*Credential, error)

func (*Client) GetCredentialByName

func (c *Client) GetCredentialByName(name string) (*Credential, error)

func (*Client) GetServerByID

func (c *Client) GetServerByID(id int) (*Server, error)

func (*Client) GetServerByName

func (c *Client) GetServerByName(name string) (*Server, error)

func (*Client) ListCredentials

func (c *Client) ListCredentials() ([]Credential, error)

ListCredentials

func (*Client) ListServers

func (c *Client) ListServers() ([]Server, error)

ListServers

func (*Client) NewRequest

func (c *Client) NewRequest(method string, path string, body interface{}) (*http.Request, error)

NewRequest returns a new pre-configured HTTP Request

func (*Client) SetUserAgent

func (c *Client) SetUserAgent(ua string) error

SetUserAgent adds an additional user agent string to all requests

type Credential

type Credential struct {
	ID   int    `json:"id"`
	Type string `json:"type"`
	Name string `json:"name"`
}

Credential

type CredentialsListResponse

type CredentialsListResponse struct {
	Credentials []Credential `json:"credentials"`
}

CredentialsListResponse

type Server

type Server struct {
	ID               int      `json:"id,omitempty"`
	CredentialID     int      `json:"credential_id"`
	Platform         string   `json:"provider"`
	PlatformID       string   `json:"provider_id,omitempty"`
	Name             string   `json:"name"`
	Size             string   `json:"size"`
	Region           string   `json:"region"` //"ams2",
	PHPVersion       string   `json:"php_version"`
	IPAddress        string   `json:"ip_address,omitempty"`         //null,
	PrivateIPAddress string   `json:"private_ip_address,omitempty"` //null,
	BlackFireStatus  string   `json:"blackfire_status,omitempty"`   //null,
	PaperTrailStatus string   `json:"papertrail_status,omitempty"`  //null,
	Revoked          bool     `json:"revoked,omitempty"`            //false,
	CreatedAt        string   `json:"created_at,omitempty"`         //"2016-12-15 15:04:05",
	IsReady          bool     `json:"is_ready,omitempty"`
	SSHPort          int      `json:"ssh_port,omitempty"`
	Tags             []string `json:"tags,omitempty"`
	Network          []int    `json:"network,omitempty"`
	SudoPassword     string   `json:"sudo_password,omitempty"`
	DatabasePassword string   `json:"database_password,omitempty"`
}

Server

type ServerResponse

type ServerResponse struct {
	Server           Server `json:"server"`
	SudoPassword     string `json:"sudo_password,omitempty"`
	DatabasePassword string `json:"database_password,omitempty"`
}

type ServersListResponse

type ServersListResponse struct {
	Servers []Server `json:"servers"`
}

ServersListResponse

Jump to

Keyboard shortcuts

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