// ExecuteAction method executes a custom action on an alert at OpsGenie. func (cli *OpsGenieAlertClient) ExecuteAction(req alerts.ExecuteActionAlertRequest) (*alerts.ExecuteActionAlertResponse, error) { req.APIKey = cli.apiKey resp, err := cli.sendRequest(cli.buildPostRequest(executeActionAlertURL, req)) if resp == nil { return nil, err } defer resp.Body.Close() var executeActionAlertResp alerts.ExecuteActionAlertResponse if err = resp.Body.FromJsonTo(&executeActionAlertResp); err != nil { message := "Server response can not be parsed, " + err.Error() logging.Logger().Warn(message) return nil, errors.New(message) } return &executeActionAlertResp, nil }