Documentation ¶
Overview ¶
Package client is a Go client for the Liima API.
Index ¶
- Constants
- func CloseMockClient()
- type Cli
- type Client
- type CommandOptionsCreateDeployment
- type CommandOptionsGetDeployment
- type CommandOptionsHostName
- type CommandOptionsPromoteDeployments
- type Config
- type DeploymentFilter
- type DeploymentFilterComp
- type DeploymentRequest
- type DeploymentResponse
- type DeploymentState
- type Deployments
- type Hostnames
- type MockClient
- type TLSClientConfig
Constants ¶
const DateTimeFormat = "2006-01-02 15:04MST"
DateTimeFormat defines the actual date time format
const LiimaDateTimeFormat = "2006-01-02T15:04:05-0700"
LiimaDateTimeFormat defines the format for Liima UTC
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the API client that performs all operations against a liima server.
func NewMockClient ¶
NewMockClient creates a new liima client from the config
func NewMockClientWithCustomHttpClient ¶ added in v0.0.5
Creates a new Liima client with mocked http.Client
func (*Client) DoRequest ¶
func (c *Client) DoRequest(method string, url string, bodyType interface{}, responseType interface{}) error
DoRequest set up a json for the given url and calls the llima client. Method: http.MethodX URL: Resturl The bodyType will be marshaled to the rest body, depending the method The result will be unmarshaled to the responseType
type CommandOptionsCreateDeployment ¶
type CommandOptionsCreateDeployment struct { AppServer string `json:"appServerName"` AppName []string `json:"applicationName"` AppVersion []string `json:"version"` Environment string `json:"environmentName"` Release string `json:"releaseName"` DeploymentDate string `json:"deploymentDate"` ExecuteShakedownTest bool `json:"executeShakedownTest"` Key []string `json:"key"` Value []string `json:"value"` Wait bool //Wait as long the WaitTime until the deployment success or failed MaxWaitTime int //Max wait time [seconds] until the deployment success or failed FromEnvironment string //Deploy last deployment from given environment }
CommandOptionsCreateDeployment used for the command options (flags)
type CommandOptionsGetDeployment ¶
type CommandOptionsGetDeployment struct { AppName []string `json:"appName"` AppServer []string `json:"appServerName"` DeploymentState []DeploymentState `json:"deploymentState"` Environment []string `json:"environmentName"` TrackingID int `json:"trackingId"` OnlyLatest bool `json:"onlyLatest"` Filter []DeploymentFilter ID []int //deployment id }
CommandOptionsGetDeployment used for the command options (flags)
type CommandOptionsHostName ¶
type CommandOptionsHostName struct { AppServer []string `json:"appServer"` Runtime []string `json:"runtime"` Environment []string `json:"environment"` Host []string `json:"host"` Node []string `json:"node"` DisableMerge bool `json:"disableMerge"` }
CommandOptionsHostName used for the command options (flags)
type CommandOptionsPromoteDeployments ¶ added in v0.0.2
type CommandOptionsPromoteDeployments struct { Environment string `json:"environmentName"` DeploymentDate string `json:"deploymentDate"` ExecuteShakedownTest bool `json:"executeShakedownTest"` Wait bool //Wait as long the WaitTime until the deployment success or failed MaxWaitTime int //Max wait time [seconds] until the deployment success or failed FromEnvironment string //Deploy last deployment from given environment WhitelistAppServer []string //Whitelist with all appServer, which should be deployed, if not WhitelistAppServer is defined, the whole environment will deployed (exclusive blacklist) BlacklistAppServer []string //Blacklist with all appServer, which should not be deployed BlacklistRuntime []string //Blacklist with all runtimes, which should not be deployed Silent bool //silent mode, no confirmation of promote the whole environment }
CommandOptionsPromoteDeployments used for the command options (flags)
type Config ¶
type Config struct { // URL to the base of the liima server Host string // Server requires Basic authentication Username string Password string // TLSClientConfig contains settings to enable transport layer security TLSClientConfig }
Config options for the liima client
type DeploymentFilter ¶ added in v0.0.2
type DeploymentFilter struct { Name string `json:"name"` Comp DeploymentFilterComp `json:"comp"` Val interface{} `json:"val"` }
DeploymentFilter is a Liima deployment filter
type DeploymentFilterComp ¶ added in v0.0.2
type DeploymentFilterComp string
DeploymentFilterComp is a Liima deployment filter comperator
const ( Eq DeploymentFilterComp = "eq" Lt DeploymentFilterComp = "lt" Lte DeploymentFilterComp = "lte" Gt DeploymentFilterComp = "gt" Gte DeploymentFilterComp = "gte" Neq DeploymentFilterComp = "neq" )
Enumeration of deployment comperators
type DeploymentRequest ¶ added in v0.0.3
type DeploymentRequest struct { ReleaseName *string `json:"releaseName"` AppServerName string `json:"appServerName"` EnvironmentName string `json:"environmentName"` AppsWithVersion []appsWithVersion `json:"appsWithVersion"` DeploymentParameters []deploymentParameters `json:"deploymentParameters"` StateToDeploy string `json:"stateToDeploy"` ContextIds []string `json:"contextIds"` DeploymentDate string `json:"deploymentDate"` SendEmail bool `json:"sendEmail"` RequestOnly bool `json:"requestOnly"` Simulate bool `json:"simulate"` ExecuteShakedownTest bool `json:"executeShakedownTest"` NeighbourhoodTest bool `json:"neighbourhoodTest"` }
DeploymentRequest type
type DeploymentResponse ¶ added in v0.0.2
type DeploymentResponse struct { ID int `json:"id"` TrackingID int `json:"trackingId"` State DeploymentState `json:"state"` DeploymentDate int64 `json:"deploymentDate"` AppServerName string `json:"appServerName"` AppServerID int `json:"appServerId"` AppsWithVersion []struct { ApplicationName string `json:"applicationName"` Version string `json:"version"` } `json:"appsWithVersion"` DeploymentParameters []interface{} `json:"deploymentParameters"` EnvironmentName string `json:"environmentName"` ReleaseName string `json:"releaseName"` RuntimeName string `json:"runtimeName"` RequestUser string `json:"requestUser"` ConfirmUser string `json:"confirmUser"` CancelUser interface{} `json:"cancelUser"` NodeJobs []interface{} `json:"nodeJobs"` CancleUser interface{} `json:"cancleUser"` }
DeploymentResponse type is autogenerated with https://mholt.github.io/json-to-go/
func CreateDeployment ¶
func CreateDeployment(cli *Cli, commandOptions *CommandOptionsCreateDeployment) (*DeploymentResponse, error)
CreateDeployment create a deployment and returns the deploymentresponse from the client
type DeploymentState ¶ added in v0.0.2
type DeploymentState string
DeploymentState is the state of a Liima deployment
const ( DeploymentStateSuccess DeploymentState = "success" DeploymentStateFailed DeploymentState = "failed" DeploymentStateCanceled DeploymentState = "canceled" DeploymentStateRejected DeploymentState = "rejected" DeploymentStateReadyForDeploy DeploymentState = "ready_for_deploy" DeploymentStatePreDeploy DeploymentState = "pre_deploy" DeploymentStateProgress DeploymentState = "progress" DeploymentStateSimulating DeploymentState = "simulating" DeploymentStateDelayed DeploymentState = "delayed" DeploymentStateScheduled DeploymentState = "scheduled" DeploymentStateRequested DeploymentState = "requested" )
Enumeration of deployment state
type Deployments ¶
type Deployments []DeploymentResponse
Deployments is a collection of DeploymentResponse
func GetDeployment ¶
func GetDeployment(cli *Cli, commandOptions *CommandOptionsGetDeployment) (Deployments, error)
GetDeployment return the deployment from the client
func PromoteDeployments ¶ added in v0.0.2
func PromoteDeployments(cli *Cli, commandOptions *CommandOptionsPromoteDeployments) (Deployments, error)
PromoteDeployments creates multiple deployments and returns the deploymentresponse
func (Deployments) Less ¶
func (slice Deployments) Less(i, j int) bool
func (Deployments) Swap ¶
func (slice Deployments) Swap(i, j int)
type Hostnames ¶
type Hostnames []struct { Host string `json:"host"` AppServer string `json:"appServer"` AppServerRelease string `json:"appServerRelease"` Runtime string `json:"runtime"` Node string `json:"node"` NodeRelease string `json:"nodeRelease"` Environment string `json:"environment"` Domain string `json:"domain"` DefinedOnNode bool `json:"definedOnNode"` }
Hostnames type
func GetHostname ¶
func GetHostname(cli *Cli, commandOptions *CommandOptionsHostName) (Hostnames, error)
GetHostname return the hostnames from the client
type MockClient ¶
type MockClient struct{}
MockClient used for mocking http client
func (*MockClient) DoRequest ¶
func (c *MockClient) DoRequest(method string, url string, bodyType interface{}, responseType interface{}) error
DoRequest set up a json for the given url and calls the llima client. Method: http.MethodX URL: Resturl The bodyType will be marshaled to the rest body, depending the method The result will be unmarshaled to the responseType
type TLSClientConfig ¶
type TLSClientConfig struct { // Server requires TLS client certificate authentication CertFile string // Server requires TLS client certificate authentication KeyFile string // Trusted root certificates for server CAFile string // InsecureSkipVerify controls whether a client verifies the // server's certificate chain and host name. InsecureSkipVerify bool // TLS renegotiation support. Default is NEVER. TlsRenegotiation tls.RenegotiationSupport }
TLSClientConfig contains settings to enable transport layer security
func (*TLSClientConfig) Validate ¶
func (config *TLSClientConfig) Validate() []error
Validate TLSClientConfig