0

在 terratest 中,我想调用 aws cloud watch 特定的日志组名称和日志流名称,下面的代码来自 git hub 但不知道如何调用特定的日志组和日志流

https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/go/example_code/cloudwatch/CloudWatchGetLogEvents.go

4

1 回答 1

0

尝试这样的事情

c := aws.NewCloudWatchLogsClient(t, awsRegion)
t.Run("logStreamExists", func(t *testing.T) {
        output, err := c.DescribeLogStreams(&cloudwatchlogs.DescribeLogStreamsInput{
            LogGroupName: &logGroupName,
        })
        if err != nil {
            assert.Fail(t, "Failed to get log streams")
        }
    var names []string
    for _, element := range output.LogStreams {
        names = append(names, *element.LogStreamName)
    }
    assert.Contains(t, names, logStreamName)
})
于 2019-07-05T10:29:13.977 回答