Documentation ¶
Index ¶
- Constants
- Variables
- func PrintTsvln(values ...interface{})
- func Run(args []string) int
- func RunTest(args []string) int
- func SelectResources(data TmpJSON, resourceType string) map[string][]map[string]interface{}
- func SplitTSV(str string) []string
- func ToTSV(values []interface{}) string
- type App
- type AppSet
- type Client
- func (c *Client) APIReq(v interface{}, method, path string, body interface{}) error
- func (c *Client) Delete(path string) error
- func (c *Client) DoReq(req *http.Request, v interface{}) error
- func (c *Client) Get(v interface{}, path string) error
- func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error)
- func (c *Client) Patch(v interface{}, path string, body interface{}) error
- func (c *Client) Post(v interface{}, path string, body interface{}) error
- func (c *Client) PrintHeaderln(values ...interface{})
- func (c *Client) Println(values ...interface{})
- func (c *Client) Put(v interface{}, path string, body interface{}) error
- type Container
- func (c Container) GetID() string
- func (c Container) GetReferencedIDs() []jsonapi.ReferenceID
- func (c Container) GetReferencedStructs() []jsonapi.MarshalIdentifier
- func (c Container) GetReferences() []jsonapi.Reference
- func (c *Container) SetID(ID string) error
- func (c *Container) SetToOneReferenceID(name, ID string) error
- type Env
- type Envs
- type JSONTime
- type Port
- type PortMapping
- type PortMappings
- type Ports
- type TaskPorts
- type TmpJSON
- type User
Examples ¶
Constants ¶
const VERSION = "v0.1.3"
VERSION is cli version.
Variables ¶
var ExitCode = 0
ExitCode is exit code.
Functions ¶
func PrintTsvln ¶
func PrintTsvln(values ...interface{})
PrintTsvln print Tab-separated values line.
func Run ¶
Run arukas
Example ¶
runCommand([]string{"arukas", "run", "nginx:latest", "--instances", "1", "--mem", "256", "-p", "80:tcp"})
Output: ID IMAGE CREATED STATUS NAME ENDPOINT 2b21fe34-328f-4d7e-8678-726d9eff2b7f nginx:latest 2015-10-19T15:05:34.843+09:00 interrupted stopped-container stopped-container.arukascloud.io
func SelectResources ¶
SelectResources returns the type filter value of TmpJSON.
Types ¶
type App ¶
type App struct { ID string `json:"-"` Name string `json:"name"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"-"` ContainerID string `json:"-"` Container *Container `json:"-"` User *User `json:"-"` }
App represents a application data in struct variables.
func (*App) SetToOneReferenceID ¶
SetToOneReferenceID sets the reference ID and satisfies the jsonapi.UnmarshalToOneRelations interface
type AppSet ¶
AppSet represents a application data in struct variables.
func (AppSet) MarshalJSON ¶
MarshalJSON returns as as the JSON encoding of as.
func (*AppSet) UnmarshalJSON ¶
UnmarshalJSON sets *as to a copy of data.
type Client ¶
type Client struct { APIURL *url.URL HTTP *http.Client Username string Password string UserAgent string Debug bool Output func(...interface{}) OutputDest io.Writer Timeout time.Duration }
Client represents a user client data in struct variables.
func NewClient ¶
NewClient returns a new arukas client, requires an authorization key. You can generate a API key by visiting the Keys section of the Arukas control panel for your account.
func NewClientWithOsExitOnErr ¶
func NewClientWithOsExitOnErr() *Client
NewClientWithOsExitOnErr return client.
func (*Client) APIReq ¶
APIReq Sends a Arukas API request and decodes the response into v. As described in NewRequest(), the type of body determines how to encode the request body. As described in DoReq(), the type of v determines how to handle the response body.
func (*Client) DoReq ¶
DoReq Submits an HTTP request, checks its response, and deserializes the response into v. The type of v determines how to handle the response body:
nil body is discarded io.Writer body is copied directly into v else body is decoded into v as json
func (*Client) NewRequest ¶
NewRequest Generates an HTTP request for the Arukas API, but does not perform the request. The request's Accept header field will be set to:
Accept: application/vnd.api+json;
The type of body determines how to encode the request:
nil no body io.Reader body is sent verbatim []byte body is encoded as application/vnd.api+json else body is encoded as application/json
func (*Client) PrintHeaderln ¶
func (c *Client) PrintHeaderln(values ...interface{})
PrintHeaderln print as the values.
type Container ¶
type Container struct { Envs Envs `json:"envs"` Ports Ports `json:"ports"` PortMappings PortMappings `json:"port_mappings,omitempty"` StatusText string `json:"status_text,omitempty"` ID string ImageName string `json:"image_name"` CreatedAt JSONTime `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` App *App Mem int `json:"mem"` AppID string `json:"app_id"` Instances int `json:"instances"` IsRunning bool `json:"is_running,omitempty"` Cmd string `json:"cmd"` Name string `json:"name"` Endpoint string `json:"end_point,omitempty"` }
Container represents a docker container data in struct variables.
func (Container) GetReferencedIDs ¶
func (c Container) GetReferencedIDs() []jsonapi.ReferenceID
GetReferencedIDs satisfies the jsonapi.MarshalLinkedRelations interface.
func (Container) GetReferencedStructs ¶
func (c Container) GetReferencedStructs() []jsonapi.MarshalIdentifier
GetReferencedStructs to satisfy the jsonapi.MarhsalIncludedRelations interface.
func (Container) GetReferences ¶
GetReferences returns all related structs to transactions.
func (*Container) SetToOneReferenceID ¶
SetToOneReferenceID sets the reference ID and satisfies the jsonapi.UnmarshalToOneRelations interface.
type JSONTime ¶
JSONTime is time.Time that serializes as unix timestamp (in microseconds).
func (JSONTime) MarshalJSON ¶
MarshalJSON returns t as the JSON encoding of t.
func (*JSONTime) UnmarshalJSON ¶
UnmarshalJSON sets *t to a copy of data.
type PortMapping ¶
type PortMapping struct { ContainerPort int `json:"container_port"` ServicePort int `json:"service_port"` Host string `json:"host"` }
PortMapping represents a docker container port mapping in struct variables.
type TmpJSON ¶
type TmpJSON struct { Data []map[string]interface{} `json:"data"` Meta map[string]interface{} `json:"-"` }
TmpJSON Contain JSON data.
type User ¶
type User struct { ID string `json:"-"` // user id Name string `json:"name"` // user name Email string `json:"email"` // user e-mail Provider string `json:"provider"` // user oAuth provider ImageURL string `json:"image_url"` // user profile image CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` ConfirmedAt time.Time `json:"-"` }
User represents a user data in struct variables.