阅读CloudWatch日志查询状态在GO SDK V2中
我正在通过V2 SDK运行CloudWatch日志查询。我已经成功地使用Startquery方法提交了查询,但是我似乎无法处理结果。
我在变量(queryID)中有查询ID,并且正在使用GetQueryResults方法如下:
results, err := svc.GetQueryResults(context.TODO(), &cloudwatchlogs.GetQueryResultsInput{QueryId: queryId,})
我如何实际阅读内容?具体来说,我正在查看状态字段。如果我在命令行中运行查询,则将其作为字符串描述返回。根据SDK文档的说法,这是一种定制类型的“ querystatus”,该类型定义为枚举常数。
我尝试过与常量名称进行比较,例如
if results.Status == cloudwatchlogs.GetQueryResultsOutput.QueryStatus.QueryStatusComplete
编译器不接受。如何引用常数或到达字符串值本身?
I'm running a CloudWatch log query through the v2 SDK for Go. I've successfully submitted the query using the StartQuery method, however I can't seem to process the results.
I've got my query ID in a variable (queryID) and am using the GetQueryResults method as follows:
results, err := svc.GetQueryResults(context.TODO(), &cloudwatchlogs.GetQueryResultsInput{QueryId: queryId,})
How do I actually read the contents? Specifically, I'm looking at the Status field. If I run the query at the command line, this comes back as a string description. According to the SDK docs, this is a bespoke type "QueryStatus", which is defined as a string with enumerated constants.
I've tried comparing to the constant names, e.g.
if results.Status == cloudwatchlogs.GetQueryResultsOutput.QueryStatus.QueryStatusComplete
but the compiler doesn't accept this. How do I either reference the constants or get to the string value itself?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
querystatus
类型是定义的在单独的类型软件包中。 GO SDK服务都是这样组织的。The
QueryStatus
type is defined in the separate types package. The Go SDK services are all organised this way.