Documentation ¶
Overview ¶
Example (Repl) ¶
in := bytes.NewBufferString("{\"name\":\"Mike\"}\nerr\n") repl(hello, in, os.Stdout)
Output: name=Mike {"message":"Hello, Mike!"} name=Stranger {"message":"Hello, Stranger!"}
Index ¶
- Constants
- Variables
- func BodyTruncator(body io.ReadCloser) (string, io.ReadCloser, error)
- func Debug(dl DebugLevel, msgFormat string, args ...interface{})
- func GetStatusCodeForMessage(msg string) int
- func GetURLBase(host string, path string) (*url.URL, error)
- func GetUrlBase(host string) (*url.URL, error)
- func GetValue(StoredValues map[string]string, key string, defaultvalue string) string
- func IsDebug() bool
- func IsHttpRespSuccess(r *http.Response) bool
- func IsResponseResultSuccess(data []byte) bool
- func IsVerbose() bool
- func ObfuscateText(text string, replacements []ObfuscateSet) string
- func PrintJSON(v interface{})
- func PrintRequestInfo(req *http.Request, secretToObfuscate ...ObfuscateSet) (*http.Request, error)
- func PrintResponseInfo(resp *http.Response, secretToObfuscate ...ObfuscateSet) (*http.Response, []byte, error)
- func ReadProps(path string) (map[string]string, error)
- func SetDebug(b bool)
- func SetVerbose(b bool)
- func Start(fn ActionFunction)
- func StartWithArgs(action ActionFunction, args []string)
- func TruncateStr(str string, maxlen int) string
- func Verbose(msgFormat string, args ...interface{})
- type Action
- func (action Action) ActionURL(apiHost string, apiPath string, apiVersion string, pkg string) (string, error)
- func (action Action) Compare(sortable Sortable) bool
- func (action Action) ToHeaderString() string
- func (action Action) ToSummaryRowString() string
- func (action Action) WebAction() (webExportValue bool)
- type ActionFunction
- type ActionListOptions
- type ActionService
- func (s *ActionService) Delete(actionName string) (*http.Response, error)
- func (s *ActionService) Get(actionName string, fetchCode bool) (*Action, *http.Response, error)
- func (s *ActionService) Insert(action *Action, overwrite bool) (*Action, *http.Response, error)
- func (s *ActionService) Invoke(actionName string, payload interface{}, blocking bool, result bool) (interface{}, *http.Response, error)
- func (s *ActionService) List(packageName string, options *ActionListOptions) ([]Action, *http.Response, error)
- type Activation
- type ActivationCount
- type ActivationCountOptions
- type ActivationFilteredRow
- type ActivationListOptions
- type ActivationService
- func (s *ActivationService) Count(options *ActivationCountOptions) (*ActivationCount, *http.Response, error)
- 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 Api
- type ApiAction
- type ApiCreateRequest
- type ApiCreateRequestOptions
- type ApiCreateResponse
- type ApiDeleteRequest
- type ApiDeleteRequestOptions
- type ApiDeleteResponse
- type ApiFilteredList
- type ApiFilteredRow
- type ApiGetRequest
- type ApiGetRequestOptions
- type ApiGetResponse
- type ApiItem
- type ApiListRequest
- type ApiListRequestOptions
- type ApiListResponse
- type ApiOptions
- type ApiParameter
- type ApiService
- func (s *ApiService) Delete(api *ApiDeleteRequest, options *ApiDeleteRequestOptions) (*http.Response, error)
- func (s *ApiService) Get(api *ApiGetRequest, options *ApiGetRequestOptions) (*ApiGetResponse, *http.Response, error)
- func (s *ApiService) Insert(api *ApiCreateRequest, options *ApiCreateRequestOptions, overwrite bool) (*ApiCreateResponse, *http.Response, error)
- func (s *ApiService) List(apiListOptions *ApiListRequestOptions) (*ApiListResponse, *http.Response, error)
- type ApiSwagger
- type ApiSwaggerInfo
- type ApiSwaggerOpXOpenWhisk
- type ApiSwaggerOperation
- type ApiSwaggerPath
- type ApiUserAuth
- type AppErrorResult
- type Binding
- type BindingPackage
- type BindingUpdates
- type Client
- func (c *Client) Do(req *http.Request, v interface{}, ExitWithErrorOnTimeout bool, ...) (*http.Response, error)
- func (c *Client) LoadX509KeyPair() error
- func (c *Client) NewRequest(method, urlStr string, body interface{}, includeNamespaceInUrl bool) (*http.Request, error)
- func (c *Client) NewRequestUrl(method string, urlRelResource *url.URL, body interface{}, ...) (*http.Request, error)
- type ClientInterface
- type Config
- func GetConfigFromWhiskProperties(pi Properties) (*Config, error)
- func GetConfigFromWskprops(pi Properties, path string) (*Config, error)
- func GetDefaultConfig() (*Config, error)
- func GetDefaultConfigFromProperties(pi Properties) (*Config, error)
- func GetWhiskPropertiesConfig() (*Config, error)
- func GetWskpropsConfig(path string) (*Config, error)
- type DebugLevel
- type ErrorResponse
- type Exec
- type Info
- type InfoService
- type KeyValue
- type KeyValueArr
- type Limits
- type Log
- type Namespace
- type NamespaceService
- type OSPackage
- type OSPackageImp
- type ObfuscateSet
- 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 Printable
- type Properties
- type PropertiesImp
- type Response
- type Result
- type RetApi
- type RetApiArray
- 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 Sortable
- type Trigger
- type TriggerListOptions
- type TriggerService
- func (s *TriggerService) Delete(triggerName string) (*Trigger, *http.Response, error)
- func (s *TriggerService) Fire(triggerName string, payload interface{}) (*Trigger, *http.Response, error)
- func (s *TriggerService) Get(triggerName string) (*Trigger, *http.Response, error)
- func (s *TriggerService) Insert(trigger *Trigger, overwrite bool) (*Trigger, *http.Response, error)
- func (s *TriggerService) List(options *TriggerListOptions) ([]Trigger, *http.Response, error)
- type TriggerServiceInterface
- type WhiskError
- type WhiskErrorResponse
- type WhiskResponse
- type WhiskResult
- type WskError
- type Wskprops
Examples ¶
Constants ¶
const ( Overwrite = true DoNotOverwrite = false )
const ( AuthRequired = true NoAuth = false IncludeNamespaceInUrl = true DoNotIncludeNamespaceInUrl = false AppendOpenWhiskPathPrefix = true DoNotAppendOpenWhiskPathPrefix = false EncodeBodyAsJson = "json" EncodeBodyAsFormData = "formdata" ProcessTimeOut = true DoNotProcessTimeOut = false ExitWithErrorOnTimeout = true ExitWithSuccessOnTimeout = false DEFAULT_HTTP_TIMEOUT = 30 )
const ( OPENWHISK_HOME = "OPENWHISK_HOME" HOMEPATH = "HOME" DEFAULT_LOCAL_CONFIG = ".wskprops" OPENWHISK_PROPERTIES = "whisk.properties" TEST_AUTH_FILE = "testing.auth" OPENWHISK_PRO = "whisk.api.host.proto" OPENWHISK_PORT = "whisk.api.host.port" OPENWHISK_HOST = "whisk.api.host.name" DEFAULT_VERSION = "v1" DEFAULT_NAMESPACE = "_" APIGW_ACCESS_TOKEN = "APIGW_ACCESS_TOKEN" APIGW_TENANT_ID = "APIGW_TENANT_ID" APIHOST = "APIHOST" APIVERSION = "APIVERSION" AUTH = "AUTH" CERT = "CERT" KEY = "KEY" NAMESPACE = "NAMESPACE" DEFAULT_SOURCE = "wsk props" WSKPROP = "wsk props" WHISK_PROPERTY = "whisk.properties" )
const APPLICATION_ERR bool = true
const DISPLAY_MSG bool = true
const DISPLAY_PREFIX bool = true
const DISPLAY_USAGE bool = true
const EXIT_CODE_ERR_GENERAL int = 1
const EXIT_CODE_ERR_HTTP_RESP int = 4
const EXIT_CODE_ERR_NETWORK int = 3
const EXIT_CODE_ERR_USAGE int = 2
const EXIT_CODE_NOT_FOUND int = 148
const EXIT_CODE_TIMED_OUT int = 202
const MaxNameLen int = 25
const NOT_ALLOWED int = 149
const NO_APPLICATION_ERR bool = false
const NO_DISPLAY_MSG bool = false
const NO_DISPLAY_PREFIX bool = false
const NO_DISPLAY_USAGE bool = false
const NO_MSG_DISPLAYED bool = false
const TIMED_OUT bool = true
Variables ¶
var ApiVerbs map[string]bool = map[string]bool{ "GET": true, "PUT": true, "POST": true, "DELETE": true, "PATCH": true, "HEAD": true, "OPTIONS": true, }
var DefaultObfuscateArr = []ObfuscateSet{
{
Regex: "\"[Pp]assword\":\\s*\".*\"",
Replacement: `"password": "******"`,
},
}
var GetDefaultWskProp = func(pi Properties) (*Wskprops, error) { var dep *Wskprops dep = pi.GetPropsFromWskprops("") error := ValidateWskprops(dep) if error != nil { dep_whisk := pi.GetPropsFromWhiskProperties() error_whisk := ValidateWskprops(dep_whisk) if error_whisk != nil { return dep, error } else { return dep_whisk, error_whisk } } return dep, error }
var GetWskPropFromWhiskProperty = func(pi Properties) (*Wskprops, error) { var dep *Wskprops dep = pi.GetPropsFromWhiskProperties() error := ValidateWskprops(dep) return dep, error }
var GetWskPropFromWskprops = func(pi Properties, path string) (*Wskprops, error) { var dep *Wskprops dep = pi.GetPropsFromWskprops(path) error := ValidateWskprops(dep) return dep, error }
var ReadX509KeyPair = func(certFile, keyFile string) (tls.Certificate, error) { return tls.LoadX509KeyPair(certFile, keyFile) }
var StatusCodes = []string{"success", "application error", "developer error", "internal error"}
Status codes to descriptions
var ValidateWskprops = func(wskprops *Wskprops) error { errStr := "" if len(wskprops.APIHost) == 0 { if wskprops.Source == WHISK_PROPERTY { errStr = wski18n.T("OpenWhisk API host is missing (Please configure WHISK_APIHOST in .wskprops under the system HOME directory.)") } else { errStr = wski18n.T("OpenWhisk API host is missing (Please configure whisk.api.host.proto, whisk.api.host.name and whisk.api.host.port in whisk.properties under the OPENWHISK_HOME directory.)") } return MakeWskError(errors.New(errStr), EXIT_CODE_ERR_GENERAL, DISPLAY_MSG, DISPLAY_USAGE) } else { if len(wskprops.AuthKey) == 0 { if wskprops.Source == WHISK_PROPERTY { errStr = wski18n.T("Authentication key is missing (Please configure AUTH in .wskprops under the system HOME directory.)") } else { errStr = wski18n.T("Authentication key is missing (Please configure testing.auth as the path of the authentication key file in whisk.properties under the OPENWHISK_HOME directory.)") } return MakeWskError(errors.New(errStr), EXIT_CODE_ERR_GENERAL, DISPLAY_MSG, DISPLAY_USAGE) } else { return nil } } }
Functions ¶
func BodyTruncator ¶
func BodyTruncator(body io.ReadCloser) (string, io.ReadCloser, error)
bodyTruncator limits the size of Req/Resp Body for --verbose ONLY. It returns truncated Req/Resp Body, reloaded io.ReadCloser and any errors.
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 formatted message without any appended \n
func GetStatusCodeForMessage ¶
func IsHttpRespSuccess ¶
func IsResponseResultSuccess ¶
func ObfuscateText ¶
func ObfuscateText(text string, replacements []ObfuscateSet) string
func PrintRequestInfo ¶
func PrintResponseInfo ¶
func SetVerbose ¶
func SetVerbose(b bool)
func Start ¶
func Start(fn ActionFunction)
Start will start a loop reading in stdin and outputting in fd3 This is expected to be uses for implementing Go actions
Example ¶
StartWithArgs(hello, []string{"{\"name\":\"Mike\"}", "err"})
Output: name=Mike {"message":"Hello, Mike!"} name=Stranger {"message":"Hello, Stranger!"}
func StartWithArgs ¶
func StartWithArgs(action ActionFunction, args []string)
StartWithArgs will execute the function for each arg If there are no args it will start a read-write loop on the function Expected to be used as starting point for implementing Go Actions as whisk.StartWithArgs(function, os.Args[:1]) if args are 2 (command and one parameter) it will invoke the function once otherwise it will stat the function in a read-write loop
func TruncateStr ¶
TruncateStr() returns the string, truncated with ...in the middle if it exceeds the specified length
Types ¶
type Action ¶
type Action struct { Namespace string `json:"namespace,omitempty"` Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` Exec *Exec `json:"exec,omitempty"` Annotations KeyValueArr `json:"annotations,omitempty"` DelAnnotations []string `json:"delAnnotations,omitempty"` Parameters KeyValueArr `json:"parameters,omitempty"` Limits *Limits `json:"limits,omitempty"` Error string `json:"error,omitempty"` Code int `json:"code,omitempty"` Publish *bool `json:"publish,omitempty"` Updated int64 `json:"updated,omitempty"` Env KeyValueArr `json:"env,omitempty"` }
func (Action) ActionURL ¶
func (action Action) ActionURL(apiHost string, apiPath string, apiVersion string, pkg string) (string, error)
Returns the URL of an action as a string. A valid API host, path and version must be passed. A package that contains the action must be passed as well. An empty string must be passed if the action is not packaged.
func (Action) Compare ¶
Compare(sortable) compares action to sortable for the purpose of sorting. REQUIRED: sortable must also be of type Action. ***Method of type Sortable***
func (Action) ToHeaderString ¶
ToHeaderString() returns the header for a list of actions
func (Action) ToSummaryRowString ¶
ToSummaryRowString() returns a compound string of required parameters for printing from CLI command `wsk action list`. ***Method of type Sortable***
type ActionFunction ¶
type ActionFunction func(event json.RawMessage) (json.RawMessage, error)
ActionFunction is the signature of an action in OpenWhisk
type ActionListOptions ¶
type ActionService ¶
type ActionService struct {
// contains filtered or unexported fields
}
func (*ActionService) Delete ¶
func (s *ActionService) Delete(actionName string) (*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"` Name string `json:"name"` Version string `json:"version"` Subject string `json:"subject"` ActivationID string `json:"activationId"` Cause string `json:"cause,omitempty"` Start int64 `json:"start"` // 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 Duration int64 `json:"duration"` // Only available for actions StatusCode int `json:"statusCode"` Response `json:"response"` Logs []string `json:"logs"` Annotations KeyValueArr `json:"annotations"` Publish *bool `json:"publish,omitempty"` }
func (Activation) Compare ¶
func (activation Activation) Compare(sortable Sortable) bool
Compare(sortable) compares activation to sortable for the purpose of sorting. REQUIRED: sortable must also be of type Activation. ***Method of type Sortable*** ***Currently, no method of sorting defined***
type ActivationCount ¶
type ActivationCount struct {
Activations int64 `json:"activations"`
}
type ActivationCountOptions ¶
type ActivationFilteredRow ¶
type ActivationFilteredRow struct { Row Activation HeaderFmt string RowFmt string }
func (ActivationFilteredRow) Compare ¶
func (activation ActivationFilteredRow) Compare(sortable Sortable) bool
Compare(sortable) compares activation to sortable for the purpose of sorting. REQUIRED: sortable must also be of type Activation. ***Method of type Sortable*** ***Currently, no method of sorting defined***
func (ActivationFilteredRow) ToHeaderString ¶
func (activation ActivationFilteredRow) ToHeaderString() string
ToHeaderString() returns the header for a list of activations
func (ActivationFilteredRow) ToSummaryRowString ¶
func (activation ActivationFilteredRow) ToSummaryRowString() string
ToSummaryRowString() returns a compound string of required parameters for printing
from CLI command `wsk activation list`.
***Method of type Sortable***
type ActivationListOptions ¶
type ActivationService ¶
type ActivationService struct {
// contains filtered or unexported fields
}
func (*ActivationService) Count ¶
func (s *ActivationService) Count(options *ActivationCountOptions) (*ActivationCount, *http.Response, error)
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 Api ¶
type Api struct { Namespace string `json:"namespace,omitempty"` ApiName string `json:"apiName,omitempty"` GatewayBasePath string `json:"gatewayBasePath,omitempty"` GatewayRelPath string `json:"gatewayPath,omitempty"` GatewayMethod string `json:"gatewayMethod,omitempty"` Id string `json:"id,omitempty"` GatewayFullPath string `json:"gatewayFullPath,omitempty"` Swagger string `json:"swagger,omitempty"` Action *ApiAction `json:"action,omitempty"` PathParameters []ApiParameter `json:"pathParameters,omitempty"` }
type ApiCreateRequest ¶
type ApiCreateRequest struct {
ApiDoc *Api `json:"apidoc,omitempty"`
}
wsk api create : Request, Response
type ApiCreateRequestOptions ¶
type ApiCreateRequestOptions ApiOptions
type ApiCreateResponse ¶
type ApiCreateResponse RetApi
type ApiDeleteRequestOptions ¶
type ApiDeleteRequestOptions ApiOptions
type ApiDeleteResponse ¶
type ApiDeleteResponse struct{}
type ApiFilteredList ¶
type ApiFilteredList struct { ActionName string ApiName string BasePath string RelPath string Verb string Url string }
Used for printing individual APIs in non-truncated form
func (ApiFilteredList) Compare ¶
func (api ApiFilteredList) Compare(sortable Sortable) bool
Compare(sortable) compares api to sortable for the purpose of sorting. REQUIRED: sortable must also be of type ApiFilteredList. ***Method of type Sortable***
func (ApiFilteredList) ToHeaderString ¶
func (api ApiFilteredList) ToHeaderString() string
ToHeaderString() returns the header for a list of apis
func (ApiFilteredList) ToSummaryRowString ¶
func (api ApiFilteredList) ToSummaryRowString() string
ToSummaryRowString() returns a compound string of required parameters for printing
from CLI command `wsk api list` or `wsk api-experimental list`.
***Method of type Sortable***
type ApiFilteredRow ¶
type ApiFilteredRow struct { ActionName string ApiName string BasePath string RelPath string Verb string Url string FmtString string }
Used for printing individual APIs in truncated form
func (ApiFilteredRow) Compare ¶
func (api ApiFilteredRow) Compare(sortable Sortable) bool
Compare(sortable) compares api to sortable for the purpose of sorting. REQUIRED: sortable must also be of type ApiFilteredRow. ***Method of type Sortable***
func (ApiFilteredRow) ToHeaderString ¶
func (api ApiFilteredRow) ToHeaderString() string
ToHeaderString() returns the header for a list of apis
func (ApiFilteredRow) ToSummaryRowString ¶
func (api ApiFilteredRow) ToSummaryRowString() string
ToSummaryRowString() returns a compound string of required parameters for printing
from CLI command `wsk api list -f` or `wsk api-experimental list -f`.
***Method of type Sortable***
type ApiGetRequestOptions ¶
type ApiGetRequestOptions ApiOptions
type ApiGetResponse ¶
type ApiGetResponse RetApiArray
type ApiListRequestOptions ¶
type ApiListRequestOptions struct { ApiOptions Limit int `url:"limit"` Skip int `url:"skip"` Docs bool `url:"docs,omitempty"` }
type ApiListResponse ¶
type ApiListResponse RetApiArray
type ApiOptions ¶
type ApiOptions struct { ActionName string `url:"action,omitempty"` ApiBasePath string `url:"basepath,omitempty"` ApiRelPath string `url:"relpath,omitempty"` ApiVerb string `url:"operation,omitempty"` ApiName string `url:"apiname,omitempty"` SpaceGuid string `url:"spaceguid,omitempty"` AccessToken string `url:"accesstoken,omitempty"` ResponseType string `url:"responsetype,omitempty"` }
type ApiParameter ¶
type ApiParameter struct { Name string `json:"name"` In string `json:"in"` Description string `json:"description,omitempty"` Required bool `json:"required,omitempty"` Type string `json:"type,omitempty"` Format string `json:"format,omitempty"` AllowEmptyValue bool `json:"allowEmptyValue,omitempty"` Items map[string]interface{} `json:"items,omitempty"` CollectionFormat string `json:"collectionFormat,omitempty"` Default interface{} `json:"default,omitempty"` Maximum int `json:"maximum,omitempty"` ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"` Minimum int `json:"minimum,omitempty"` ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"` MaxLength int `json:"maxLength,omitempty"` MinLength int `json:"minLength,omitempty"` Pattern string `json:"pattern,omitempty"` MaxItems int `json:"maxItems,omitempty"` MinItems int `json:"minItems,omitempty"` UniqueItems bool `json:"uniqueItems,omitempty"` MultipleOf int `json:"multipleOf,omitempty"` Enum interface{} `json:"enum,omitempty"` Ref string `json:"$ref,omitempty"` }
type ApiService ¶
type ApiService struct {
// contains filtered or unexported fields
}
func (*ApiService) Delete ¶
func (s *ApiService) Delete(api *ApiDeleteRequest, options *ApiDeleteRequestOptions) (*http.Response, error)
func (*ApiService) Get ¶
func (s *ApiService) Get(api *ApiGetRequest, options *ApiGetRequestOptions) (*ApiGetResponse, *http.Response, error)
func (*ApiService) Insert ¶
func (s *ApiService) Insert(api *ApiCreateRequest, options *ApiCreateRequestOptions, overwrite bool) (*ApiCreateResponse, *http.Response, error)
func (*ApiService) List ¶
func (s *ApiService) List(apiListOptions *ApiListRequestOptions) (*ApiListResponse, *http.Response, error)
type ApiSwagger ¶
type ApiSwagger struct { SwaggerName string `json:"swagger,omitempty"` BasePath string `json:"basePath,omitempty"` Info *ApiSwaggerInfo `json:"info,omitempty"` Paths map[string]*ApiSwaggerPath `json:"paths,omitempty"` SecurityDef interface{} `json:"securityDefinitions,omitempty"` Security interface{} `json:"security,omitempty"` XConfig interface{} `json:"x-ibm-configuration,omitempty"` XRateLimit interface{} `json:"x-ibm-rate-limit,omitempty"` }
type ApiSwaggerInfo ¶
type ApiSwaggerOpXOpenWhisk ¶
type ApiSwaggerOperation ¶
type ApiSwaggerOperation struct { OperationId string `json:"operationId"` Parameters []ApiParameter `json:"parameters,omitempty"` Responses interface{} `json:"responses"` XOpenWhisk *ApiSwaggerOpXOpenWhisk `json:"x-openwhisk,omitempty"` }
type ApiSwaggerPath ¶
type ApiSwaggerPath struct { Get *ApiSwaggerOperation `json:"get,omitempty"` Put *ApiSwaggerOperation `json:"put,omitempty"` Post *ApiSwaggerOperation `json:"post,omitempty"` Delete *ApiSwaggerOperation `json:"delete,omitempty"` Options *ApiSwaggerOperation `json:"options,omitempty"` Head *ApiSwaggerOperation `json:"head,omitempty"` Patch *ApiSwaggerOperation `json:"patch,omitempty"` Parameters []ApiParameter `json:"parameters,omitempty"` }
func (*ApiSwaggerPath) MakeOperationMap ¶
func (asp *ApiSwaggerPath) MakeOperationMap() map[string]*ApiSwaggerOperation
type ApiUserAuth ¶
type AppErrorResult ¶
type AppErrorResult struct {
Error *interface{} `json:"error"`
}
type BindingPackage ¶
type BindingPackage struct { Namespace string `json:"-"` Name string `json:"-"` Version string `json:"version,omitempty"` Publish *bool `json:"publish,omitempty"` Annotations KeyValueArr `json:"annotations,omitempty"` Parameters KeyValueArr `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 TriggerServiceInterface Actions *ActionService Rules *RuleService Activations *ActivationService Packages *PackageService Namespaces *NamespaceService Info *InfoService Apis *ApiService // contains filtered or unexported fields }
func NewClient ¶
NewClient creates a new whisk client with the provided http client and whisk configuration.
A new http.Transport will be created when client cert or TLS insecure options are set. If one use custom transport and want to keep it intact, please opt out TLS related fields in configInput and construct TLS configuration in the custom transport.
func (*Client) Do ¶
func (c *Client) Do(req *http.Request, v interface{}, ExitWithErrorOnTimeout bool, secretToObfuscate ...ObfuscateSet) (*http.Response, error)
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) LoadX509KeyPair ¶
func (*Client) NewRequest ¶
func (*Client) NewRequestUrl ¶
func (c *Client) NewRequestUrl( method string, urlRelResource *url.URL, body interface{}, includeNamespaceInUrl bool, appendOpenWhiskPath bool, encodeBodyAs string, useAuthentication bool) (*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 includeNamespaceInUrl - when true "/namespaces/NAMESPACE" is included in the final URL; otherwise not included. appendOpenWhiskPath - when true, the OpenWhisk URL format is generated encodeBodyAs - specifies body encoding (json or form data) useAuthentication - when true, the basic Authorization is included with the configured authkey as the value
type ClientInterface ¶
type ClientInterface interface { NewRequestUrl(method string, urlRelResource *url.URL, body interface{}, includeNamespaceInUrl bool, appendOpenWhiskPath bool, encodeBodyAs string, useAuthentication bool) (*http.Request, error) NewRequest(method, urlStr string, body interface{}, includeNamespaceInUrl bool) (*http.Request, error) Do(req *http.Request, v interface{}, ExitWithErrorOnTimeout bool, secretToObfuscate ...ObfuscateSet) (*http.Response, error) }
type Config ¶
type Config struct { Namespace string // NOTE :: Default is "_" Cert string Key string AuthToken string Host string BaseURL *url.URL // NOTE :: Default is "openwhisk.ng.bluemix.net" Version string Verbose bool Debug bool // For detailed tracing Insecure bool UserAgent string ApigwAccessToken string ApigwTenantId string AdditionalHeaders http.Header }
func GetConfigFromWhiskProperties ¶
func GetConfigFromWhiskProperties(pi Properties) (*Config, error)
func GetConfigFromWskprops ¶
func GetConfigFromWskprops(pi Properties, path string) (*Config, error)
func GetDefaultConfig ¶
func GetDefaultConfigFromProperties ¶
func GetDefaultConfigFromProperties(pi Properties) (*Config, error)
func GetWskpropsConfig ¶
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 `json:"-"` // HTTP response that caused this error ErrMsg *interface{} `json:"error"` // error message string Code *interface{} `json:"code"` // validation error code (tid) }
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,omitempty"` Image string `json:"image,omitempty"` Init string `json:"init,omitempty"` Main string `json:"main,omitempty"` Components []string `json:"components,omitempty"` // List of fully qualified actions Binary *bool `json:"binary,omitempty"` }
type InfoService ¶
type InfoService struct {
// contains filtered or unexported fields
}
type KeyValueArr ¶
type KeyValueArr []KeyValue
func (KeyValueArr) AddOrReplace ¶
func (keyValueArr KeyValueArr) AddOrReplace(kv *KeyValue) KeyValueArr
* Adds the specified KeyValue to the key value array. If the KeyValue's key * is already in the array, that entry is updated with the KeyValue's value. * * Returns a new key value array with the update
func (KeyValueArr) AppendKeyValueArr ¶
func (keyValueArr KeyValueArr) AppendKeyValueArr(appKeyValueArr KeyValueArr) KeyValueArr
Appends items from appKeyValueArr to keyValueArr if the appKeyValueArr item does not exist in keyValueArr.
func (KeyValueArr) FindKeyValue ¶
func (keyValueArr KeyValueArr) FindKeyValue(key string) int
func (KeyValueArr) GetValue ¶
func (keyValueArr KeyValueArr) GetValue(key string) (res interface{})
Retrieves a value associated with a given key from a KeyValueArr. A key of type string must be passed to the method. An interface will be returned containing the found value. If a key could not be found, a nil value will be returned.
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"`
}
func (Namespace) Compare ¶
Compare(sortable) compares namespace to sortable for the purpose of sorting. REQUIRED: sortable must also be of type Namespace. ***Method of type Sortable***
func (Namespace) ToHeaderString ¶
ToHeaderString() returns the header for a list of namespaces
func (Namespace) ToSummaryRowString ¶
ToSummaryRowString() returns a compound string of required parameters for printing
from CLI command `wsk namespace list`.
***Method of type Sortable***
type NamespaceService ¶
type NamespaceService struct {
// contains filtered or unexported fields
}
type OSPackageImp ¶
type OSPackageImp struct{}
type ObfuscateSet ¶
type Package ¶
type Package struct { Namespace string `json:"namespace,omitempty"` Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` Publish *bool `json:"publish,omitempty"` Annotations KeyValueArr `json:"annotations,omitempty"` Parameters KeyValueArr `json:"parameters,omitempty"` Binding *Binding `json:"binding,omitempty"` Actions []Action `json:"actions,omitempty"` Feeds []Action `json:"feeds,omitempty"` Updated int64 `json:"updated,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???
func (Package) Compare ¶
Compare(sortable) compares xPackage to sortable for the purpose of sorting. REQUIRED: sortable must also be of type Package. ***Method of type Sortable***
func (Package) ToHeaderString ¶
ToHeaderString() returns the header for a list of actions
func (Package) ToSummaryRowString ¶
ToSummaryRowString() returns a compound string of required parameters for printing
from CLI command `wsk package list`.
***Method of type Sortable***
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 Parameters ¶
type Parameters *json.RawMessage
type Printable ¶
type Printable interface { ToHeaderString() string // Prints header information of a Printable ToSummaryRowString() string // Prints summary info of one Printable }
Printable items are anything that need to be printed for listing purposes.
type Properties ¶
type Properties interface { GetPropsFromWskprops(string) *Wskprops GetPropsFromWhiskProperties() *Wskprops }
func GetProperties ¶
func GetProperties() Properties
type PropertiesImp ¶
type PropertiesImp struct {
OsPackage OSPackage
}
func (PropertiesImp) GetPropsFromWhiskProperties ¶
func (pi PropertiesImp) GetPropsFromWhiskProperties() *Wskprops
func (PropertiesImp) GetPropsFromWskprops ¶
func (pi PropertiesImp) GetPropsFromWskprops(path string) *Wskprops
type RetApi ¶
type RetApi struct { Namespace string `json:"namespace"` BaseUrl string `json:"gwApiUrl"` Activated bool `json:"gwApiActivated"` TenantId string `json:"tenantId"` Swagger *ApiSwagger `json:"apidoc,omitempty"` }
type RetApiArray ¶
type RetApiArray struct {
Apis []ApiItem `json:"apis,omitempty"`
}
type Rule ¶
type Rule struct { Namespace string `json:"namespace,omitempty"` Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` Annotations KeyValueArr `json:"annotations,omitempty"` Status string `json:"status"` Trigger interface{} `json:"trigger"` Action interface{} `json:"action"` Publish *bool `json:"publish,omitempty"` Updated int64 `json:"updated,omitempty"` }
func (Rule) Compare ¶
Compare(sortable) compares rule to sortable for the purpose of sorting. REQUIRED: sortable must also be of type Rule. ***Method of type Sortable***
func (Rule) ToHeaderString ¶
ToHeaderString() returns the header for a list of rules
func (Rule) ToSummaryRowString ¶
ToSummaryRowString() returns a compound string of required parameters for printing
from CLI command `wsk rule list`.
***Method of type Sortable***
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 Sortable ¶
type Sortable interface { // Compare(sortable) compares an two sortables and returns true // if the item calling the Compare method is less than toBeCompared. // Sorts alphabetically by default, can have other parameters to sort by // passed by sortByName. Compare(toBeCompared Sortable) bool }
Sortable items are anything that needs to be sorted for listing purposes.
type Trigger ¶
type Trigger struct { Namespace string `json:"namespace,omitempty"` Name string `json:"name,omityempty"` Version string `json:"version,omitempty"` ActivationId string `json:"activationId,omitempty"` Annotations KeyValueArr `json:"annotations,omitempty"` Parameters KeyValueArr `json:"parameters,omitempty"` Limits *Limits `json:"limits,omitempty"` Publish *bool `json:"publish,omitempty"` Rules map[string]interface{} `json:"rules,omitempty"` Updated int64 `json:"updated,omitempty"` }
func (Trigger) Compare ¶
Compare(sortable) compares trigger to sortable for the purpose of sorting. REQUIRED: sortable must also be of type Trigger. ***Method of type Sortable***
func (Trigger) ToHeaderString ¶
ToHeaderString() returns the header for a list of triggers
func (Trigger) ToSummaryRowString ¶
ToSummaryRowString() returns a compound string of required parameters for printing
from CLI command `wsk trigger list`.
***Method of type Sortable***
type TriggerListOptions ¶
type TriggerService ¶
type TriggerService struct {
// contains filtered or unexported fields
}
func (*TriggerService) List ¶
func (s *TriggerService) List(options *TriggerListOptions) ([]Trigger, *http.Response, error)
type TriggerServiceInterface ¶
type TriggerServiceInterface interface { List(options *TriggerListOptions) ([]Trigger, *http.Response, error) Insert(trigger *Trigger, overwrite bool) (*Trigger, *http.Response, error) Get(triggerName string) (*Trigger, *http.Response, error) Delete(triggerName string) (*Trigger, *http.Response, error) Fire(triggerName string, payload interface{}) (*Trigger, *http.Response, error) }
type WhiskError ¶
type WhiskError struct {
Msg *string `json:"msg"`
}
type WhiskErrorResponse ¶
type WhiskErrorResponse struct {
Response *WhiskResponse `json:"response"`
}
type WhiskResponse ¶
type WhiskResult ¶
type WhiskResult struct { }
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 DisplayPrefix bool // When true, the CLI will prefix an error message with "error: " ApplicationError bool // When true, the error is a result of an application failure TimedOut bool // When True, the error is a result of a timeout }
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: " bool - TimedOut. If true, the error is a result of a timeout
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 bool - TimedOut. If true, the error resulted from a timeout