lolp

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2020 License: MIT Imports: 15 Imported by: 0

README

lolp

lolp: A Lolipop! Managed Cloud API client library for Go



Travis GitHub release MIT License Go Documentation

Installation

To install, use go get:

$ go get -d github.com/pepabo/golipop

Usage

As CLI:

$ eval $(lolp login -u <your@example.com> -p <your_password>)
$ lolp project create -k rails -s foobar -d password:<your_password>
foobar.lolipop.io
$ lolp project foobar
ID                 "cdd32ae5-c118-4fc9-b9d6-ea5ad18f3737"
Kind               "rails"
Domain             "foobar.lolipop.io"
...

As library:

client := lolp.DefaultClinet()
token, err := client.Login("your@example.com", "your_password")
if err != nil {
  panic(err)
}
p := &ProjectNew{
  Kind: "rails",
  Database: map[string]interface{} {"password": "********"},
}
project, err := client.CreateProject(p)
if err != nil {
  panic(err)
}

Contribution

  1. Fork (https://github.com/pepabo/golipop/fork)
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Run test suite with the go test ./... command and confirm that it passes
  6. Run gofmt -s
  7. Create a new Pull Request

Author

linyows

Documentation

Index

Constants

View Source
const (

	// EndpointEnvVar for endpoint
	EndpointEnvVar = "LOLP_ENDPOINT"

	// TLSNoVerifyEnvVar for TLS verify skip flag
	TLSNoVerifyEnvVar = "LOLP_TLS_NOVERIFY"

	// TokenEnvVar for authentication
	TokenEnvVar = "LOLP_TOKEN"
)
View Source
const Name string = "lolp"

Name for this

View Source
const Version string = "0.0.6"

Version for this

Variables

This section is empty.

Functions

This section is empty.

Types

type AppError

type AppError struct {
	Errors []string `json:"errors"`
}

AppError struct

func (*AppError) Error

func (re *AppError) Error() string

Error returns error by string

type Client

type Client struct {
	URL           *url.URL
	HTTPClient    *http.Client
	DefaultHeader http.Header
	Token         string
}

Client struct

func New

func New() *Client

New returns client struct pointer

func NewClient

func NewClient(u string) (*Client, error)

NewClient returns clean client struct pointer

func (*Client) AddPublicKey added in v0.0.4

func (c *Client) AddPublicKey(p *PublicKey) (*PublicKey, error)

AddPublicKey add OpenSSH public key

func (*Client) Authenticate

func (c *Client) Authenticate(u string, p string) (string, error)

Authenticate for authorization

func (*Client) CreateProject

func (c *Client) CreateProject(p *ProjectNew) (*ProjectCreateResponse, error)

CreateProject creates project with kind

func (*Client) DeleteProject

func (c *Client) DeleteProject(name string) error

DeleteProject deletes project by project sub-domain name

func (*Client) DeletePublicKey added in v0.0.4

func (c *Client) DeletePublicKey(name string) error

DeletePublicKey delete OpenSSH public key

func (*Client) DisableAutoscaling added in v0.0.5

func (c *Client) DisableAutoscaling(name string) error

DisableAutoscaling disable autoscaling by project sub-domain name

func (*Client) EnableAutoscaling added in v0.0.5

func (c *Client) EnableAutoscaling(name string) error

EnableAutoscaling enable autoscaling by project sub-domain name

func (*Client) GetEnvironmentVariables added in v0.0.6

func (c *Client) GetEnvironmentVariables(name string) (string, error)

func (*Client) HTTP

func (c *Client) HTTP(verb, spath string, ro *RequestOptions) (*http.Response, error)

HTTP returns http.Response with dispose

func (*Client) Project

func (c *Client) Project(name string) (*Project, error)

Project returns a project by sub-domain name

func (*Client) Projects

func (c *Client) Projects() (*[]Project, error)

Projects returns project list

func (*Client) Request

func (c *Client) Request(verb, spath string, ro *RequestOptions) (*http.Request, error)

Request returns http.Request pointer with error

func (*Client) UpdateEnvironmentVariables added in v0.0.6

func (c *Client) UpdateEnvironmentVariables(name string, params []UpdateEnvironmentVariablesParam) error

type CustomDomain added in v0.0.5

type CustomDomain struct {
	Name string `json:"name,omitempty"`
}

type Database added in v0.0.2

type Database struct {
	Host string `json:"host,omitempty"`
	User string `json:"user,omitempty"`
	Name string `json:"name,omitempty"`
}

type Project

type Project struct {
	ID            string         `json:"id,omitempty"`
	Name          string         `json:"name,omitempty"`
	Kind          string         `json:"kind,omitempty"`
	Domain        string         `json:"domain,omitempty"`
	SubDomain     string         `json:"subDomain,omitempty"`
	Autoscalable  bool           `json:"autoscalable,omitempty"`
	CustomDomains []CustomDomain `json:"customDomains,omitempty"`
	Database      Database       `json:"database,omitempty"`
	SSH           *SSH           `json:"ssh,omitempty"`
	CreatedAt     time.Time      `json:"createdAt,omitempty"`
	UpdatedAt     time.Time      `json:"updatedAt,omitempty"`
}

Project struct

type ProjectCreateResponse added in v0.0.4

type ProjectCreateResponse struct {
	ID     string `json:"id"`
	Domain string `json:"domain"`
}

type ProjectNew

type ProjectNew struct {
	Name          string                 `json:"name,omitempty"`
	Kind          string                 `json:"kind,omitempty""`
	SubDomain     string                 `json:"sub_domain,omitempty"`
	CustomDomains []string               `json:"custom_domains,omitempty"`
	Payload       map[string]interface{} `json:"payload,omitempty"`
	DBPassword    string                 `json:"db_password,omitempty"`
}

ProjectNew struct on create

type PublicKey added in v0.0.4

type PublicKey struct {
	Name string `json:"name"`
	Key  string `json:"key"`
}

type RequestOptions

type RequestOptions struct {
	Params     map[string]string
	Headers    map[string]string
	Body       io.Reader
	BodyLength int64
}

RequestOptions struct

type SSH added in v0.0.2

type SSH struct {
	User string `json:"user,omitempty"`
	Host string `json:"host,omitempty"`
	Port int    `json:"port,omitempty"`
}

type UpdateEnvironmentVariablesParam added in v0.0.6

type UpdateEnvironmentVariablesParam struct {
	Method   string `json:"method"`
	Variable struct {
		Key   string `json:"key"`
		Value string `json:"value"`
	} `json:"variable"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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