client

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewError

func NewError(text string) error

NewError returns an error that formats as the given text.

Types

type Auth

type Auth struct {
	APIKey, SecretKey string
}

Auth struct for API and secret key

func (*Auth) SignRequest

func (a *Auth) SignRequest(req *http.Request) error

SignRequest method to sign all requests

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client struct

func MakeClient

func MakeClient(apiKey, secretKey, endpoint string) (*Client, error)

MakeClient make client

func (*Client) CreateCloudAccount

func (c *Client) CreateCloudAccount(ctx context.Context, teamID, accessKeyID, secretAccessKey, cloudName string) (*CloudAccount, error)

CreateCloudAccount method to create a cloud object

func (*Client) CreateComposite

func (c *Client) CreateComposite(ctx context.Context, gitURL, name, teamID, gitKeyID string) (*Composite, error)

CreateComposite method to create a composite object

func (*Client) CreateGitKey

func (c *Client) CreateGitKey(ctx context.Context, teamID, keyMaterial, name string) (*GitKey, error)

CreateGitKey method to create a gitKey object

func (*Client) CreatePlan added in v0.0.3

func (c *Client) CreatePlan(ctx context.Context, planConfigContent []byte) (*Plan, error)

CreatePlan Create plan

func (*Client) CreateTeam added in v0.0.7

func (c *Client) CreateTeam(ctx context.Context, teamName, teamDescription string) (*Team, error)

CreateTeam method to create a new team

func (*Client) CreateToken

func (c *Client) CreateToken(ctx context.Context, name, description string) (*Token, error)

CreateToken method to create a token object

func (*Client) DeleteCloudAccountByID

func (c *Client) DeleteCloudAccountByID(ctx context.Context, teamID, cloudID string) error

DeleteCloudAccountByID method to delete cloud object

func (*Client) DeleteCompositeByID added in v0.0.7

func (c *Client) DeleteCompositeByID(ctx context.Context, teamID, compositeID string) error

DeleteCompositeByID method to delete composite info object

func (*Client) DeleteGitKeyByID

func (c *Client) DeleteGitKeyByID(ctx context.Context, teamID, gitKeyID string) error

DeleteGitKeyByID method to delete gitKey object

func (*Client) DeletePlanByID

func (c *Client) DeletePlanByID(ctx context.Context, teamID, compositeID, planID string) error

DeletePlanByID method to delete cloud object

func (*Client) DeleteTokenByID

func (c *Client) DeleteTokenByID(ctx context.Context, tokenID string) error

DeleteTokenByID method to delete token object

func (*Client) DisablePlan

func (c *Client) DisablePlan(ctx context.Context, teamID, compositeID, planID string) (*Plan, error)

DisablePlan method to disable a plan object

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, path string, body io.Reader, obj interface{}) error

Do performs an HTTP request with a given context - the response will be decoded into obj.

func (*Client) EnablePlan

func (c *Client) EnablePlan(ctx context.Context, teamID, compositeID, planID string) (*Plan, error)

EnablePlan method to enable a plan object

func (*Client) GetCloudAccountByID

func (c *Client) GetCloudAccountByID(ctx context.Context, teamID, cloudID string) (*CloudAccount, error)

GetCloudAccountByID method getting cloud account by user ID

func (*Client) GetCloudAccounts

func (c *Client) GetCloudAccounts(ctx context.Context, teamID string) ([]*CloudAccount, error)

GetCloudAccounts method for cloud command

func (*Client) GetCompositeByID

func (c *Client) GetCompositeByID(ctx context.Context, teamID, compositeID string) (*Composite, error)

GetCompositeByID method to get composite info object

func (*Client) GetComposites

func (c *Client) GetComposites(ctx context.Context, teamID string) ([]*Composite, error)

GetComposites method to get composite info array object

func (*Client) GetGitKeyByID

func (c *Client) GetGitKeyByID(ctx context.Context, teamID, gitKeyID string) (*GitKey, error)

GetGitKeyByID method for gitKey command

func (*Client) GetGitKeys

func (c *Client) GetGitKeys(ctx context.Context, teamID string) ([]*GitKey, error)

GetGitKeys method for gitKey command

func (*Client) GetPanelInfo added in v0.0.3

func (c *Client) GetPanelInfo(ctx context.Context, teamID, compositeID, planID string) (*Panel, error)

GetPanelInfo get panel info

func (*Client) GetPlanByID

func (c *Client) GetPlanByID(ctx context.Context, teamID, compositeID, planID string) (*Plan, error)

GetPlanByID method to get plan info object

func (*Client) GetPlans

func (c *Client) GetPlans(ctx context.Context, teamID, compositeID string) ([]*Plan, error)

GetPlans method to get plans info array object

func (*Client) GetTeamByID

func (c *Client) GetTeamByID(ctx context.Context, teamID string) (*Team, error)

GetTeamByID method to get Team info object by team ID

func (*Client) GetTeams

func (c *Client) GetTeams(ctx context.Context) ([]*Team, error)

GetTeams method to get Teams info array object

func (*Client) GetTokenByID

func (c *Client) GetTokenByID(ctx context.Context, tokenID string) (*Token, error)

GetTokenByID method for token command

func (*Client) GetTokens

func (c *Client) GetTokens(ctx context.Context) ([]*Token, error)

GetTokens method for token command

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context) (*User, error)

GetUser method for getting user info command

func (*Client) InitPlan

func (c *Client) InitPlan(ctx context.Context, branch, name, region, teamID, cloudID, compositeID, revision string, intervalInMinutes int) (*PlanConfig, error)

InitPlan init plan

func (*Client) RunNowPlanByID added in v0.0.7

func (c *Client) RunNowPlanByID(ctx context.Context, teamID, compositeID, planID string) (*Plan, error)

RunNowPlanByID method to run-now plan info object

type CloudAccount

type CloudAccount struct {
	TeamID   string `json:"teamId"`
	Name     string `json:"name"`
	RoleID   string `json:"roleId"`
	RoleName string `json:"roleName"`
	Links    []Link `json:"links"`
	ID       string `json:"id"`
}

CloudAccount struct for api payload

type Composite

type Composite struct {
	Name               string    `json:"name"`
	GitURL             string    `json:"gitUrl"`
	HasCustomDashboard bool      `json:"hasCustomDashboard"`
	CreatedAt          time.Time `json:"createdAt"`
	GitKeyID           string    `json:"gitKeyId"`
	TeamID             string    `json:"teamId"`
	ID                 string    `json:"id"`
	Links              []Link    `json:"links"`
}

Composite struct for api payload

type GitKey

type GitKey struct {
	TeamID            string `json:"teamId"`
	Name              string `json:"name"`
	Sha256Fingerprint string `json:"sha256fingerprint"`
	Md5Fingerprint    string `json:"md5fingerprint"`
	Links             []Link `json:"links"`
	ID                string `json:"id"`
}

GitKey struct for api payload

type Interceptor

type Interceptor func(*http.Request) error

Interceptor is a generic request interceptor, useful for modifying or canceling the request.

type Link struct {
	Ref    string `json:"ref"`
	Method string `json:"method"`
	Href   string `json:"href"`
}

Link struct

func GetLinkByRef

func GetLinkByRef(links []Link, ref string) (Link, error)

GetLinkByRef get link object for given property

type Option

type Option func(*clientOptions)

Option type

func WithInterceptor

func WithInterceptor(ci Interceptor) Option

WithInterceptor returns a ClientOption for adding an interceptor to a Client.

type Panel added in v0.0.3

type Panel struct {
	ResourcesArray             interface{} `json:"resourcesArray"`
	NumberOfResources          int         `json:"numberOfResources"`
	PlanRefreshIntervalInHours int         `json:"planRefreshIntervalInHours"`
	LastExecutionTime          time.Time   `json:"lastExecutionTime"`
	EngineState                string      `json:"engineState"`
	IsEnabled                  bool        `json:"isEnabled"`
}

Panel panel struct

type Plan

type Plan struct {
	EngineRunInfos struct {
		EngineState       string    `json:"engineState"`
		EngineStatus      string    `json:"engineStatus"`
		RunID             string    `json:"runId"`
		CreatedAt         time.Time `json:"createdAt"`
		NumberOfResources int       `json:"numberOfResources"`
	} `json:"engineRunInfos"`
	DefaultPanelRepo       string  `json:"defaultPanelRepo"`
	DefaultPanelDirectory  string  `json:"defaultPanelDirectory"`
	DefaultPanelBranch     string  `json:"defaultPanelBranch"`
	Name                   string  `json:"name"`
	IamUserAccessKeyID     string  `json:"iamUserAccessKeyId"`
	IamUserID              string  `json:"iamUserId"`
	IamUserSecretAccessKey string  `json:"iamUserSecretAccessKey"`
	SnsSubscriptionArn     string  `json:"snsSubscriptionArn"`
	SqsArn                 string  `json:"sqsArn"`
	SqsURL                 string  `json:"sqsUrl"`
	TopicArn               string  `json:"topicArn"`
	EnginePrefix           string  `json:"enginePrefix"`
	IsSynchronizing        bool    `json:"isSynchronizing"`
	IsDraft                bool    `json:"isDraft"`
	DefaultRegion          string  `json:"defaultRegion"`
	RefreshInterval        float32 `json:"refreshInterval"`
	RunCounter             int     `json:"runCounter"`
	Revision               string  `json:"revision"`
	Branch                 string  `json:"branch"`
	Enabled                bool    `json:"enabled"`
	Links                  []Link  `json:"links"`
	ID                     string  `json:"id"`
	IntervalInMinutes      int     `json:"intervalInMinutes"`
}

Plan struct object

type PlanAttribute added in v0.0.3

type PlanAttribute struct {
	Namespace   string      `json:"namespace"`
	Default     interface{} `json:"default"`
	Description string      `json:"description"`
	Required    bool        `json:"required"`
	Type        string      `json:"type"`
	Class       string      `json:"class"`
	Value       interface{} `json:"value"`
}

PlanAttribute struct object

type PlanConfig

type PlanConfig struct {
	GitRevision string                   `json:"gitRevision"`
	GitBranch   string                   `json:"gitBranch"`
	TeamID      string                   `json:"teamId"`
	Links       []Link                   `json:"links"`
	Variables   map[string]PlanAttribute `json:"variables"`
	PlanID      string                   `json:"planId"`
	ID          string                   `json:"id"`
}

PlanConfig struct object

type Team

type Team struct {
	TeamName        string      `json:"teamName"`
	OwnerID         string      `json:"ownerId"`
	TeamIcon        string      `json:"teamIcon"`
	TeamDescription interface{} `json:"teamDescription"`
	Default         bool        `json:"default"`
	Links           []Link      `json:"links"`
	ID              string      `json:"id"`
}

Team struct for api payload

type Token

type Token struct {
	Name         string    `json:"name"`
	Description  string    `json:"description"`
	CreationDate time.Time `json:"creationDate"`
	Links        []Link    `json:"links"`
	ID           string    `json:"id"`
}

Token struct

type User

type User struct {
	Username        string    `json:"username"`
	Email           string    `json:"email"`
	GravatarIconURL string    `json:"gravatarIconUrl"`
	CreatedAt       time.Time `json:"createdAt"`
	DefaultTeamID   string    `json:"defaultTeamId"`
	Links           []Link    `json:"links"`
	ID              string    `json:"id"`
}

User struct for api payload

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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