Documentation ¶
Index ¶
- Constants
- func Debug(dl DebugLevel, msgFormat string, args ...interface{})
- func IsHttpRespSuccess(r *http.Response) bool
- func IsVerbose() bool
- func SetDebug(b bool)
- func SetVerbose(b bool)
- func Verbose(msgFormat string, args ...interface{})
- type Action
- type ActionListOptions
- type ActionSequence
- type ActionService
- func (s *ActionService) Delete(actionName string) (*http.Response, error)
- func (s *ActionService) Get(actionName string) (*Action, *http.Response, error)
- func (s *ActionService) Insert(action *Action, sharedSet bool, overwrite bool) (*Action, *http.Response, error)
- func (s *ActionService) Invoke(actionName string, payload *json.RawMessage, blocking bool) (*Activation, *http.Response, error)
- func (s *ActionService) List(packageName string, options *ActionListOptions) ([]Action, *http.Response, error)
- type Activation
- type ActivationListOptions
- type ActivationService
- func (s *ActivationService) Get(activationID string) (*Activation, *http.Response, error)
- func (s *ActivationService) List(options *ActivationListOptions) ([]Activation, *http.Response, error)
- func (s *ActivationService) Logs(activationID string) (*Activation, *http.Response, error)
- func (s *ActivationService) Result(activationID string) (*Response, *http.Response, error)
- type Annotations
- type Binding
- type BindingPackage
- type BindingUpdates
- type Client
- type Config
- type DebugLevel
- type ErrorResponse
- type Exec
- type Info
- type InfoService
- type KeyValue
- type KeyValues
- type Limits
- type Log
- type Namespace
- type NamespaceService
- type Package
- type PackageInterface
- type PackageListOptions
- type PackageService
- func (s *PackageService) Delete(packageName string) (*http.Response, error)
- func (s *PackageService) Get(packageName string) (*Package, *http.Response, error)
- func (s *PackageService) Insert(x_package PackageInterface, overwrite bool) (*Package, *http.Response, error)
- func (s *PackageService) List(options *PackageListOptions) ([]Package, *http.Response, error)
- func (s *PackageService) Refresh() (*BindingUpdates, *http.Response, error)
- type Parameters
- type Response
- type Result
- type Rule
- type RuleListOptions
- type RuleService
- func (s *RuleService) Delete(ruleName string) (*http.Response, error)
- func (s *RuleService) Get(ruleName string) (*Rule, *http.Response, error)
- func (s *RuleService) Insert(rule *Rule, overwrite bool) (*Rule, *http.Response, error)
- func (s *RuleService) List(options *RuleListOptions) ([]Rule, *http.Response, error)
- func (s *RuleService) SetState(ruleName string, state string) (*Rule, *http.Response, error)
- type Sdk
- type SdkRequest
- type SdkService
- type SentActionNoPublish
- type SentActionPublish
- type SentPackageNoPublish
- type SentPackagePublish
- type Trigger
- type TriggerFromServer
- type TriggerListOptions
- type TriggerService
- func (s *TriggerService) Delete(triggerName string) (*TriggerFromServer, *http.Response, error)
- func (s *TriggerService) Fire(triggerName string, payload *json.RawMessage) (*TriggerFromServer, *http.Response, error)
- func (s *TriggerService) Get(triggerName string) (*TriggerFromServer, *http.Response, error)
- func (s *TriggerService) Insert(trigger *Trigger, overwrite bool) (*TriggerFromServer, *http.Response, error)
- func (s *TriggerService) List(options *TriggerListOptions) ([]TriggerFromServer, *http.Response, error)
- type WhiskErrorMessage
- type WhiskErrorResponse
- type WhiskErrorResult
- type WskError
Constants ¶
const ( AuthRequired = true AuthOptional = false )
const APPLICATION_ERR bool = true
const DISPLAY_MSG bool = true
const DISPLAY_USAGE bool = true
const EXITCODE_ERR_GENERAL int = 1
const EXITCODE_ERR_HTTP_RESP int = 4
const EXITCODE_ERR_NETWORK int = 3
const EXITCODE_ERR_USAGE int = 2
const MaxNameLen int = 25
const NO_DISPLAY_MSG bool = false
const NO_DISPLAY_USAGE bool = false
const NO_MSG_DISPLAYED bool = false
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(dl DebugLevel, msgFormat string, args ...interface{})
Function for tracing debug level messages to stdout
Output format: [file-or-function-name]:line-#:[DebugLevel] The formated message without any appended \n
func IsHttpRespSuccess ¶
func SetVerbose ¶
func SetVerbose(b bool)
Types ¶
type Action ¶
type Action struct { Namespace string `json:"namespace,omitempty"` Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` Publish bool `json:"publish"` Exec *Exec `json:"exec,omitempty"` Annotations *json.RawMessage `json:"annotations,omitempty"` Parameters *json.RawMessage `json:"parameters,omitempty"` Limits *Limits `json:"limits,omitempty"` }
type ActionListOptions ¶
type ActionSequence ¶
type ActionSequence []KeyValues
type ActionService ¶
type ActionService struct {
// contains filtered or unexported fields
}
func (*ActionService) Delete ¶
func (s *ActionService) Delete(actionName string) (*http.Response, error)
func (*ActionService) Invoke ¶
func (s *ActionService) Invoke(actionName string, payload *json.RawMessage, blocking bool) (*Activation, *http.Response, error)
func (*ActionService) List ¶
func (s *ActionService) List(packageName string, options *ActionListOptions) ([]Action, *http.Response, error)
type Activation ¶
type Activation struct { Namespace string `json:"namespace,omitempty"` Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` Publish bool `json:"publish,omitempty"` Subject string `json:"subject,omitempty"` ActivationID string `json:"activationId,omitempty"` Cause string `json:"cause,omitempty"` Start int64 `json:"start,omitempty"` // When action started (in milliseconds since January 1, 1970 UTC) End int64 `json:"end"` // Since a 0 is a valid value from server, don't omit Response `json:"response,omitempty"` Logs []string `json:"logs,omitempty"` Annotations *json.RawMessage `json:"annotations,omitempty"` }
type ActivationListOptions ¶
type ActivationService ¶
type ActivationService struct {
// contains filtered or unexported fields
}
func (*ActivationService) Get ¶
func (s *ActivationService) Get(activationID string) (*Activation, *http.Response, error)
func (*ActivationService) List ¶
func (s *ActivationService) List(options *ActivationListOptions) ([]Activation, *http.Response, error)
func (*ActivationService) Logs ¶
func (s *ActivationService) Logs(activationID string) (*Activation, *http.Response, error)
type Annotations ¶
type Annotations []map[string]interface{}
type BindingPackage ¶
type BindingPackage struct { Namespace string `json:"-"` Name string `json:"-"` Version string `json:"version,omitempty"` Publish bool `json:"publish"` Annotations *json.RawMessage `json:"annotations,omitempty"` Parameters *json.RawMessage `json:"parameters,omitempty"` Binding `json:"binding"` }
Use this struct when creating a binding Publish is NOT optional; Binding is a namespace/name object, not a bool
func (*BindingPackage) GetName ¶
func (p *BindingPackage) GetName() string
type BindingUpdates ¶
type Client ¶
type Client struct { *Config Transport *http.Transport Sdks *SdkService Triggers *TriggerService Actions *ActionService Rules *RuleService Activations *ActivationService Packages *PackageService Namespaces *NamespaceService Info *InfoService // contains filtered or unexported fields }
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.
func (*Client) NewRequest ¶
func (*Client) NewRequestUrl ¶
func (c *Client) NewRequestUrl(method string, urlRelResource *url.URL, body interface{}) (*http.Request, error)
Create a HTTP request object using URL stored in url.URL object Arguments:
method - HTTP verb (i.e. "GET", "PUT", etc) urlRelResource - *url.URL structure representing the relative resource URL, including query params body - optional. Object whose contents will be JSON encoded and placed in HTTP request body
type DebugLevel ¶
type DebugLevel string
const ( DbgInfo DebugLevel = "Inf" DbgWarn DebugLevel = "Wrn" DbgError DebugLevel = "Err" DbgFatal DebugLevel = "Ftl" )
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response // HTTP response that caused this error ErrMsg string `json:"error"` // error message string Code int64 `json:"code"` // validation error code }
For containing the server response body when an error message is returned Here's an example error response body with HTTP status code == 400
{ "error": "namespace contains invalid characters", "code": 1422870 }
func (ErrorResponse) Error ¶
func (r ErrorResponse) Error() string
type Exec ¶
type Exec struct { Kind string `json:"kind,omitempty"` Code string `json:"code"` Image string `json:"image,omitempty"` Init string `json:"init,omitempty"` Jar string `json:"jar,omitempty"` Main string `json:"main,omitempty"` Components []string `json:"components,omitempty"` // List of fully qualified actions }
type InfoService ¶
type InfoService struct {
// contains filtered or unexported fields
}
type KeyValue ¶
type KeyValue struct { Key string `json:"key,omitempty"` Value interface{} `json:"value"` // Whisk permits empty values, do not add 'omitempty' }
type Log ¶
type Log struct { Log string `json:"log,omitempty"` Stream string `json:"stream,omitempty"` Time string `json:"time,omitempty"` }
MWD - This structure may no longer be needed as the log format is now a string and not JSON
type Namespace ¶
type Namespace struct { Name string `json:"name"` Contents struct { Actions []Action `json:"actions"` Packages []Package `json:"packages"` Triggers []TriggerFromServer `json:"triggers"` Rules []Rule `json:"rules"` } `json:"contents,omitempty"` }
type NamespaceService ¶
type NamespaceService struct {
// contains filtered or unexported fields
}
type Package ¶
type Package struct { Namespace string `json:"namespace,omitempty"` Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` Publish bool `json:"publish"` Annotations *json.RawMessage `json:"annotations,omitempty"` Parameters *json.RawMessage `json:"parameters,omitempty"` Binding `json:"binding,omitempty"` Actions []Action `json:"actions,omitempty"` Feeds []Action `json:"feeds,omitempty"` }
Use this struct to represent the package/binding sent from the Whisk server Binding is a bool ???MWD20160602 now seeing Binding as a struct???
type PackageInterface ¶
type PackageInterface interface {
GetName() string
}
type PackageListOptions ¶
type PackageService ¶
type PackageService struct {
// contains filtered or unexported fields
}
func (*PackageService) Delete ¶
func (s *PackageService) Delete(packageName string) (*http.Response, error)
func (*PackageService) Insert ¶
func (s *PackageService) Insert(x_package PackageInterface, overwrite bool) (*Package, *http.Response, error)
func (*PackageService) List ¶
func (s *PackageService) List(options *PackageListOptions) ([]Package, *http.Response, error)
func (*PackageService) Refresh ¶
func (s *PackageService) Refresh() (*BindingUpdates, *http.Response, error)
type RuleListOptions ¶
type RuleService ¶
type RuleService struct {
// contains filtered or unexported fields
}
func (*RuleService) List ¶
func (s *RuleService) List(options *RuleListOptions) ([]Rule, *http.Response, error)
type SdkRequest ¶
type SdkRequest struct { }
type SdkService ¶
type SdkService struct {
// contains filtered or unexported fields
}
type SentActionNoPublish ¶
type SentActionNoPublish struct { Namespace string `json:"-"` Version string `json:"-"` Publish bool `json:"publish,omitempty"` Parameters *json.RawMessage `json:"parameters,omitempty"` Exec *Exec `json:"exec,omitempty"` Annotations *json.RawMessage `json:"annotations,omitempty"` Limits *Limits `json:"limits,omitempty"` Error string `json:"error,omitempty"` Code int `json:"code,omitempty"` }
type SentActionPublish ¶
type SentActionPublish struct { Namespace string `json:"-"` Version string `json:"-"` Publish bool `json:"publish"` Parameters *json.RawMessage `json:"parameters,omitempty"` Exec *Exec `json:"exec,omitempty"` Annotations *json.RawMessage `json:"annotations,omitempty"` Limits *Limits `json:"limits,omitempty"` Error string `json:"error,omitempty"` Code int `json:"code,omitempty"` }
type SentPackageNoPublish ¶
type SentPackageNoPublish struct { Namespace string `json:"-"` Name string `json:"-"` Version string `json:"version,omitempty"` Publish bool `json:"publish,omitempty"` Annotations *json.RawMessage `json:"annotations,omitempty"` Parameters *json.RawMessage `json:"parameters,omitempty"` }
Use this struct to update a package/binding with no change to the Publish setting
func (*SentPackageNoPublish) GetName ¶
func (p *SentPackageNoPublish) GetName() string
type SentPackagePublish ¶
type SentPackagePublish struct { Namespace string `json:"-"` Name string `json:"-"` Version string `json:"version,omitempty"` Publish bool `json:"publish"` Annotations *json.RawMessage `json:"annotations,omitempty"` Parameters *json.RawMessage `json:"parameters,omitempty"` }
Use this struct to create/update a package/binding with the Publish setting
func (*SentPackagePublish) GetName ¶
func (p *SentPackagePublish) GetName() string
type Trigger ¶
type Trigger struct { Namespace string `json:"namespace,omitempty"` Name string `json:"-"` Version string `json:"version,omitempty"` Publish bool `json:"publish,omitempty"` ActivationId string `json:"activationId,omitempty"` Annotations *json.RawMessage `json:"annotations,omitempty"` Parameters *json.RawMessage `json:"parameters,omitempty"` }
type TriggerFromServer ¶
type TriggerFromServer struct { Namespace string `json:"namespace"` Name string `json:"name"` Version string `json:"version"` Publish bool `json:"publish"` ActivationId string `json:"activationId,omitempty"` Annotations *json.RawMessage `json:"annotations"` Parameters *json.RawMessage `json:"parameters"` Limits `json:"limits"` }
type TriggerListOptions ¶
type TriggerService ¶
type TriggerService struct {
// contains filtered or unexported fields
}
func (*TriggerService) Delete ¶
func (s *TriggerService) Delete(triggerName string) (*TriggerFromServer, *http.Response, error)
func (*TriggerService) Fire ¶
func (s *TriggerService) Fire(triggerName string, payload *json.RawMessage) (*TriggerFromServer, *http.Response, error)
func (*TriggerService) Get ¶
func (s *TriggerService) Get(triggerName string) (*TriggerFromServer, *http.Response, error)
func (*TriggerService) Insert ¶
func (s *TriggerService) Insert(trigger *Trigger, overwrite bool) (*TriggerFromServer, *http.Response, error)
func (*TriggerService) List ¶
func (s *TriggerService) List(options *TriggerListOptions) ([]TriggerFromServer, *http.Response, error)
type WhiskErrorMessage ¶
type WhiskErrorMessage struct {
Error *string `json:"error"`
}
type WhiskErrorResponse ¶
type WhiskErrorResponse struct {
Response WhiskErrorResult `json:"response"`
}
type WhiskErrorResult ¶
type WhiskErrorResult struct { Status string `json:"status"` Success bool `json:"success"` Result WhiskErrorMessage `json:"result"` }
type WskError ¶
type WskError struct { RootErr error // Parent error ExitCode int // Error code to be returned to the OS DisplayMsg bool // When true, the error message should be displayed to console MsgDisplayed bool // When true, the error message has already been displayed, don't display it again DisplayUsage bool // When true, the CLI usage should be displayed before exiting ApplicationError bool // When true, the error is a result of an application failure }
func MakeWskError ¶
Instantiate a WskError structure Parameters:
error - RootErr. object implementing the error interface int - ExitCode. Used if error object does not have an exit code OR if ExitCodeOverride is true bool - DisplayMsg. If true, the error message should be displayed on the console bool - DisplayUsage. If true, the command usage syntax/help should be displayed on the console bool - MsgDisplayed. If true, the error message has been displayed on the console bool - DisplayPreview. If true, the error message will be prefixed with "error: "
func MakeWskErrorFromWskError ¶
func MakeWskErrorFromWskError(baseError error, whiskError error, exitCode int, flags ...bool) (resWhiskError *WskError)
Instantiate a WskError structure Parameters:
error - RootErr. object implementing the error interface WskError - WskError being wrappered. It's exitcode will be used as this WskError's exitcode. Ignored if nil int - ExitCode. Used if error object is nil or if the error object is not a WskError bool - DisplayMsg. If true, the error message should be displayed on the console bool - DisplayUsage. If true, the command usage syntax/help should be displayed on the console bool - MsgDisplayed. If true, the error message has been displayed on the console bool - ApplicationError. If true, the error is a result of an application error