Passed
Push — master ( 715886...74726c )
by eval
06:41 queued 04:58
created

ses.BulkEmailDestination.ToSDK   A

Complexity

Conditions 4

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 11
nop 0
dl 0
loc 17
rs 9.85
c 0
b 0
f 0
1
package ses
2
3
import (
4
	SDK "github.com/aws/aws-sdk-go-v2/service/ses"
5
	"github.com/evalphobia/aws-sdk-go-v2-wrapper/private/pointers"
6
)
7
8
type BulkEmailDestination struct {
0 ignored issues
show
introduced by
exported type BulkEmailDestination should have comment or be unexported
Loading history...
9
	Destination             Destination
10
	ReplacementTags         []MessageTag
11
	ReplacementTemplateData string
12
}
13
14
func (r BulkEmailDestination) ToSDK() SDK.BulkEmailDestination {
0 ignored issues
show
introduced by
exported method BulkEmailDestination.ToSDK should have comment or be unexported
Loading history...
15
	o := SDK.BulkEmailDestination{}
16
17
	o.Destination = r.Destination.ToSDK()
18
19
	if len(r.ReplacementTags) != 0 {
20
		list := make([]SDK.MessageTag, len(r.ReplacementTags))
21
		for i, v := range r.ReplacementTags {
22
			list[i] = v.ToSDK()
23
		}
24
		o.ReplacementTags = list
25
	}
26
27
	if r.ReplacementTemplateData != "" {
28
		o.ReplacementTemplateData = pointers.String(r.ReplacementTemplateData)
29
	}
30
	return o
31
}
32
33
type BulkEmailDestinationStatus struct {
0 ignored issues
show
introduced by
exported type BulkEmailDestinationStatus should have comment or be unexported
Loading history...
34
	Error     string
35
	MessageID string
36
	Status    BulkEmailStatus
37
}
38
39
func newBulkEmailDestinationStatuses(list []SDK.BulkEmailDestinationStatus) []BulkEmailDestinationStatus {
40
	if len(list) == 0 {
41
		return nil
42
	}
43
44
	results := make([]BulkEmailDestinationStatus, len(list))
45
	for i, v := range list {
46
		results[i] = newBulkEmailDestinationStatus(v)
47
	}
48
	return results
49
}
50
51
func newBulkEmailDestinationStatus(o SDK.BulkEmailDestinationStatus) BulkEmailDestinationStatus {
52
	result := BulkEmailDestinationStatus{}
53
54
	if o.Error != nil {
55
		result.Error = *o.Error
56
	}
57
	if o.MessageId != nil {
58
		result.MessageID = *o.MessageId
59
	}
60
61
	result.Status = BulkEmailStatus(o.Status)
62
	return result
63
}
64
65
type Destination struct {
0 ignored issues
show
introduced by
exported type Destination should have comment or be unexported
Loading history...
66
	BccAddresses []string
67
	CcAddresses  []string
68
	ToAddresses  []string
69
}
70
71
func (r Destination) ToSDK() *SDK.Destination {
0 ignored issues
show
introduced by
exported method Destination.ToSDK should have comment or be unexported
Loading history...
72
	o := SDK.Destination{}
73
74
	o.BccAddresses = r.BccAddresses
75
	o.CcAddresses = r.CcAddresses
76
	o.ToAddresses = r.ToAddresses
77
	return &o
78
}
79
80
type MessageTag struct {
0 ignored issues
show
introduced by
exported type MessageTag should have comment or be unexported
Loading history...
81
	Name  string
82
	Value string
83
}
84
85
func (r MessageTag) ToSDK() SDK.MessageTag {
0 ignored issues
show
introduced by
exported method MessageTag.ToSDK should have comment or be unexported
Loading history...
86
	o := SDK.MessageTag{}
87
88
	if r.Name != "" {
89
		o.Name = pointers.String(r.Name)
90
	}
91
	if r.Value != "" {
92
		o.Value = pointers.String(r.Value)
93
	}
94
	return o
95
}
96