Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ThrowStatusWebhook ¶
func ThrowStatusWebhook(cli Poster, url string, channel string, results *pb.Status, baseUrl string) error
ThrowStatusWebhook will create a status string from the protobuf message Status as defined in guideocelot.proto and
will post the data to the slack url provided. If the status code is not 200 OK, then a WebhookRejectedErr will be generated and the error body will contain the error returned from the slack api.
Types ¶
type FakePoster ¶
type FakePoster struct {
// the data that was posted to FakePoster will be posted here
PostBody []byte
// response code to return
ResponseCode int
// body to return in response
ResponseBody string
// urls that have been posted
PostedUrls []string
}
FakePoster is for testing anything related to posting slack webhooks
When you use it instead of http.DefaultClient in ThrowStatusWebhook the body posted to the client will be saved to the PostBody attribute. FakePoster will reutrn the ResponseCode and ResponseBody it will also save a list of urls that have been posted to it
func MakeFakePoster ¶
func MakeFakePoster(desiredStatusCode int, desiredReturnBody string) *FakePoster
MakeFakePoster will create a FakePoster instance for you with the desired resopnse code and response body set
type WebhookRejectedErr ¶
type WebhookRejectedErr struct {
// contains filtered or unexported fields
}
func WebhookRejected ¶
func WebhookRejected(statusCode int, errorMsg string) *WebhookRejectedErr
WebhookRejected will return a RejectedError with the reason as the message to be returned by a call to Error()
func (*WebhookRejectedErr) Error ¶
func (r *WebhookRejectedErr) Error() string
Click to show internal directories.
Click to hide internal directories.