Ai
1 Star 0 Fork 0

ryancartoon/sensu-go

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
adhoc.go 973 Bytes
Copy Edit Raw Blame History
Simon Plourde authored 2019-06-11 23:20 +08:00 . APId Refactoring (#3018)
package v2
import (
"errors"
"fmt"
"net/url"
)
// FixtureAdhocRequest returns a testing fixture for an AdhocRequest struct.
func FixtureAdhocRequest(name string, subscriptions []string) *AdhocRequest {
return &AdhocRequest{
ObjectMeta: NewObjectMeta(name, "default"),
Subscriptions: subscriptions,
}
}
// SetNamespace sets the namespace of the resource.
func (a *AdhocRequest) SetNamespace(namespace string) {
return
}
// StorePrefix returns the path prefix to this resource in the store
func (a *AdhocRequest) StorePrefix() string {
return ""
}
// Validate returns an error if the name is not provided.
func (a *AdhocRequest) Validate() error {
if a.Name == "" {
return errors.New("must provide check name")
}
return nil
}
// URIPath is the URI path component to the adhoc request.
func (a *AdhocRequest) URIPath() string {
return fmt.Sprintf("/api/core/v2/namespaces/%s/checks/%s/execute", url.PathEscape(a.Namespace), url.PathEscape(a.Name))
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ryancartoon/sensu-go.git
git@gitee.com:ryancartoon/sensu-go.git
ryancartoon
sensu-go
sensu-go
v5.10.1

Search