Documentation
¶
Index ¶
- Constants
- func HasLogLevel(l, level LogLevel) bool
- func ReadResponse(response *http.Response, data interface{}) error
- func ReadTextResponse(response *http.Response) ([]byte, error)
- type Configuration
- type Error
- type Errors
- type Execution
- type ExecutionLogs
- type ExecutionsService
- type HTTPClient
- type Log
- type LogLevel
- type LogsRequestOpts
- type SSHKey
- type SSHKeyGenerationRequest
- type SSHKeysService
- type Workflow
- type WorkflowInputs
- type Workflows
- type WorkflowsService
Constants ¶
const DefaultAPIAddress = "https://127.0.0.1:9090"
Variables ¶
This section is empty.
Functions ¶
func HasLogLevel ¶ added in v0.2.0
func ReadResponse ¶
ReadResponse is an helper function that allow to fully read and close a response body and unmarshal its json content into a provided data structure. If response status code is greater or equal to 400 it automatically parse an error response and returns it as a non-nil error.
Types ¶
type Configuration ¶
type Configuration struct {
APIURL string `mapstructure:"api_url"`
SkipTLSVerify bool `mapstructure:"skip_tls_verify"`
KeyFile string `mapstructure:"key_file"`
CertFile string `mapstructure:"cert_file"`
CAFile string `mapstructure:"ca_file"`
CAPath string `mapstructure:"ca_path"`
User string `mapstructure:"user"`
HttpClient *http.Client
}
Configuration holds the api client configuration
type Error ¶
type Error struct {
ID string `json:"id"`
Status int `json:"status"`
Title string `json:"title"`
Detail string `json:"detail"`
}
Error represent an error returned by the REST API
type Errors ¶
type Errors struct {
Errors []*Error `json:"errors"`
}
Errors is a collection of REST errors
type Execution ¶
type Execution struct {
ID string `json:"id"`
Status string `json:"status"`
Outputs map[string]interface{} `json:"outputs,omitempty"`
}
Execution is the response structure of a GetExecution operation
type ExecutionLogs ¶ added in v0.2.0
type ExecutionLogs struct {
Logs []Log `json:"logs"`
TotalResults int `json:"total_results"`
From int `json:"from"`
}
ExecutionLogs is the response structure of a GetExecutionLog operation
type ExecutionsService ¶
type HTTPClient ¶
type HTTPClient interface {
NewRequest(ctx context.Context, method, path string, body io.Reader) (*http.Request, error)
Do(req *http.Request) (*http.Response, error)
Workflows() WorkflowsService
Executions() ExecutionsService
SSHKeys() SSHKeysService
}
HTTPClient represents an HTTP client
func GetClient ¶
func GetClient(cc Configuration) (HTTPClient, error)
GetClient returns a HTTP Client
type Log ¶ added in v0.2.0
type Log struct {
Level string `json:"level"`
Timestamp time.Time `json:"timestamp"`
Content string `json:"content"`
}
Log represents the log entry return by the a4c rest api
type LogLevel ¶ added in v0.2.0
type LogLevel uint8
LogLevel
func ClearLogLevels ¶ added in v0.2.0
func SetLogLevels ¶ added in v0.2.0
type LogsRequestOpts ¶ added in v0.2.0
type SSHKey ¶
SSHKey is the response structure of a CreateKey operation for a given user
The response contains only the public key, private key is never disclosed
type SSHKeyGenerationRequest ¶
type SSHKeyGenerationRequest struct {
MetaData map[string]interface{} `json:"metadata,omitempty"`
}
SSHKeyGenerationRequest is the request structure of a CreateKey operation
type SSHKeysService ¶
type SSHKeysService interface {
GenerateSSHKey(ctx context.Context, genRequest SSHKeyGenerationRequest) (SSHKey, error)
}
type WorkflowInputs ¶
type WorkflowInputs struct {
Inputs map[string]interface{} `json:"inputs"`
}
WorkflowInputs is the payload send when triggering a workflow execution