-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathresponse_type.go
68 lines (63 loc) · 2.67 KB
/
response_type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package sqs
import (
"strconv"
)
// AttributesResponse contains attributes from GetQueueAttributes.
type AttributesResponse struct {
ApproximateNumberOfMessages int
ApproximateNumberOfMessagesDelayed int
ApproximateNumberOfMessagesNotVisible int
CreatedTimestamp int
DelaySeconds int
LastModifiedTimestamp int
MaximumMessageSize int
MessageRetentionPeriod int
QueueArn string
ReceiveMessageWaitTimeSeconds int
RedrivePolicy string
VisibilityTimeout int
// KmsMasterKeyId int
// KmsDataKeyReusePeriodSeconds int
// FifoQueue bool
// ContentBasedDeduplication int
}
func NewAttributesResponse(apiResponse map[string]*string) AttributesResponse {
a := AttributesResponse{}
if apiResponse[AttributeApproximateNumberOfMessages] != nil {
a.ApproximateNumberOfMessages, _ = strconv.Atoi(*apiResponse[AttributeApproximateNumberOfMessages])
}
if apiResponse[AttributeApproximateNumberOfMessagesDelayed] != nil {
a.ApproximateNumberOfMessagesDelayed, _ = strconv.Atoi(*apiResponse[AttributeApproximateNumberOfMessagesDelayed])
}
if apiResponse[AttributeApproximateNumberOfMessagesNotVisible] != nil {
a.ApproximateNumberOfMessagesNotVisible, _ = strconv.Atoi(*apiResponse[AttributeApproximateNumberOfMessagesNotVisible])
}
if apiResponse[AttributeCreatedTimestamp] != nil {
a.CreatedTimestamp, _ = strconv.Atoi(*apiResponse[AttributeCreatedTimestamp])
}
if apiResponse[AttributeDelaySeconds] != nil {
a.DelaySeconds, _ = strconv.Atoi(*apiResponse[AttributeDelaySeconds])
}
if apiResponse[AttributeLastModifiedTimestamp] != nil {
a.LastModifiedTimestamp, _ = strconv.Atoi(*apiResponse[AttributeLastModifiedTimestamp])
}
if apiResponse[AttributeMaximumMessageSize] != nil {
a.MaximumMessageSize, _ = strconv.Atoi(*apiResponse[AttributeMaximumMessageSize])
}
if apiResponse[AttributeMessageRetentionPeriod] != nil {
a.MessageRetentionPeriod, _ = strconv.Atoi(*apiResponse[AttributeMessageRetentionPeriod])
}
if apiResponse[AttributeReceiveMessageWaitTimeSeconds] != nil {
a.ReceiveMessageWaitTimeSeconds, _ = strconv.Atoi(*apiResponse[AttributeReceiveMessageWaitTimeSeconds])
}
if apiResponse[AttributeVisibilityTimeout] != nil {
a.VisibilityTimeout, _ = strconv.Atoi(*apiResponse[AttributeVisibilityTimeout])
}
if apiResponse[AttributeQueueArn] != nil {
a.QueueArn = *apiResponse[AttributeQueueArn]
}
if apiResponse[AttributeRedrivePolicy] != nil {
a.RedrivePolicy = *apiResponse[AttributeRedrivePolicy]
}
return a
}