in whisk/activation.go [207:243]
func (s *ActivationService) Count(options *ActivationCountOptions) (*ActivationCount, *http.Response, error) {
// TODO :: for some reason /activations only works with "_" as namespace
s.client.Namespace = "_"
route := "activations"
options.Count = true
routeUrl, err := addRouteOptions(route, options)
if err != nil {
Debug(DbgError, "addRouteOptions(%s, %#v) error: '%s'\n", route, options, err)
errStr := wski18n.T("Unable to append options '{{.options}}' to URL route '{{.route}}': {{.err}}",
map[string]interface{}{"options": fmt.Sprintf("%#v", options), "route": route, "err": err})
werr := MakeWskErrorFromWskError(errors.New(errStr), err, EXIT_CODE_ERR_GENERAL, DISPLAY_MSG, NO_DISPLAY_USAGE)
return nil, nil, werr
}
req, err := s.client.NewRequestUrl("GET", routeUrl, nil, IncludeNamespaceInUrl, AppendOpenWhiskPathPrefix, EncodeBodyAsJson, AuthRequired)
if err != nil {
Debug(DbgError, "http.NewRequestUrl(GET, %s, nil, IncludeNamespaceInUrl, AppendOpenWhiskPathPrefix, EncodeBodyAsJson, AuthRequired) error: '%s'\n", route, err)
errStr := wski18n.T("Unable to create HTTP request for GET '{{.route}}': {{.err}}",
map[string]interface{}{"route": route, "err": err})
werr := MakeWskErrorFromWskError(errors.New(errStr), err, EXIT_CODE_ERR_GENERAL, DISPLAY_MSG, NO_DISPLAY_USAGE)
return nil, nil, werr
}
Debug(DbgInfo, "Sending HTTP request - URL '%s'; req %#v\n", req.URL.String(), req)
count := new(ActivationCount)
resp, err := s.client.Do(req, &count, ExitWithSuccessOnTimeout)
if err != nil {
Debug(DbgError, "s.client.Do() error - HTTP req %s; error '%s'\n", req.URL.String(), err)
return nil, resp, err
}
return count, resp, nil
}