CloudWatch: Handle permissions error and update docs (#88524)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package models
|
||||
|
||||
import "github.com/aws/aws-sdk-go/service/cloudwatch"
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/service/cloudwatch"
|
||||
)
|
||||
|
||||
// queryRowResponse represents the GetMetricData response for a query row in the query editor.
|
||||
type QueryRowResponse struct {
|
||||
@@ -8,6 +10,8 @@ type QueryRowResponse struct {
|
||||
ErrorCodes map[string]bool
|
||||
HasArithmeticError bool
|
||||
ArithmeticErrorMessage string
|
||||
HasPermissionError bool
|
||||
PermissionErrorMessage string
|
||||
Metrics []*cloudwatch.MetricDataResult
|
||||
StatusCode string
|
||||
}
|
||||
@@ -23,6 +27,10 @@ func NewQueryRowResponse(errors map[string]bool) QueryRowResponse {
|
||||
}
|
||||
|
||||
func (q *QueryRowResponse) AddMetricDataResult(mdr *cloudwatch.MetricDataResult) {
|
||||
if mdr.Label == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if partialData, ok := q.partialDataSet[*mdr.Label]; ok {
|
||||
partialData.Timestamps = append(partialData.Timestamps, mdr.Timestamps...)
|
||||
partialData.Values = append(partialData.Values, mdr.Values...)
|
||||
@@ -44,3 +52,8 @@ func (q *QueryRowResponse) AddArithmeticError(message *string) {
|
||||
q.HasArithmeticError = true
|
||||
q.ArithmeticErrorMessage = *message
|
||||
}
|
||||
|
||||
func (q *QueryRowResponse) AddPermissionError(message *string) {
|
||||
q.HasPermissionError = true
|
||||
q.PermissionErrorMessage = *message
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user