Passed
Push — master ( 74726c...b4fc5f )
by eval
02:05
created

pinpoint.newImportJobResource   C

Complexity

Conditions 9

Size

Total Lines 31
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 9
eloc 20
nop 1
dl 0
loc 31
rs 6.6666
c 0
b 0
f 0
1
package pinpoint
2
3
import (
4
	SDK "github.com/aws/aws-sdk-go-v2/service/pinpoint"
5
	"github.com/evalphobia/aws-sdk-go-v2-wrapper/private/pointers"
6
)
7
8
type ImportJobRequest struct {
0 ignored issues
show
introduced by
exported type ImportJobRequest should have comment or be unexported
Loading history...
9
	Format  Format
10
	RoleARN string
11
	S3URL   string
12
13
	// optional
14
	DefineSegment     bool
15
	RegisterEndpoints bool
16
	SegmentID         string
17
	SegmentName       string
18
}
19
20
func (r ImportJobRequest) ToSDK() *SDK.ImportJobRequest {
0 ignored issues
show
introduced by
exported method ImportJobRequest.ToSDK should have comment or be unexported
Loading history...
21
	o := SDK.ImportJobRequest{}
22
23
	o.Format = SDK.Format(r.Format)
24
25
	if r.RoleARN != "" {
26
		o.RoleArn = pointers.String(r.RoleARN)
27
	}
28
	if r.S3URL != "" {
29
		o.S3Url = pointers.String(r.S3URL)
30
	}
31
32
	if r.DefineSegment {
33
		o.DefineSegment = pointers.Bool(r.DefineSegment)
34
	}
35
	if r.RegisterEndpoints {
36
		o.RegisterEndpoints = pointers.Bool(r.RegisterEndpoints)
37
	}
38
	if r.SegmentID != "" {
39
		o.SegmentId = pointers.String(r.SegmentID)
40
	}
41
	if r.SegmentName != "" {
42
		o.SegmentName = pointers.String(r.SegmentName)
43
	}
44
	return &o
45
}
46
47
type ImportJobsResponse struct {
0 ignored issues
show
introduced by
exported type ImportJobsResponse should have comment or be unexported
Loading history...
48
	Item      []ImportJobResponse
49
	NextToken string
50
}
51
52
func newImportJobsResponse(o *SDK.ImportJobsResponse) ImportJobsResponse {
53
	result := ImportJobsResponse{}
54
	if o == nil {
55
		return result
56
	}
57
58
	if len(o.Item) != 0 {
59
		list := make([]ImportJobResponse, len(o.Item))
60
		for i, v := range o.Item {
61
			v := v
62
			list[i] = newImportJobResponse(&v)
63
		}
64
		result.Item = list
65
	}
66
67
	if o.NextToken != nil {
68
		result.NextToken = *o.NextToken
69
	}
70
71
	return result
72
}
73
74
type ImportJobResponse struct {
0 ignored issues
show
introduced by
exported type ImportJobResponse should have comment or be unexported
Loading history...
75
	ApplicationID string
76
	CreationDate  string
77
	Definition    ImportJobResource
78
	ID            string
79
	JobStatus     JobStatus
80
	Type          string
81
82
	// optional
83
	CompletedPieces int64
84
	CompletionDate  string
85
	FailedPieces    int64
86
	Failures        []string
87
	TotalFailures   int64
88
	TotalPieces     int64
89
	TotalProcessed  int64
90
}
91
92
func newImportJobResponse(o *SDK.ImportJobResponse) ImportJobResponse {
93
	result := ImportJobResponse{}
94
	if o == nil {
95
		return result
96
	}
97
98
	if o.ApplicationId != nil {
99
		result.ApplicationID = *o.ApplicationId
100
	}
101
	if o.CreationDate != nil {
102
		result.CreationDate = *o.CreationDate
103
	}
104
105
	result.Definition = newImportJobResource(o.Definition)
106
107
	if o.Id != nil {
108
		result.ID = *o.Id
109
	}
110
111
	result.JobStatus = JobStatus(o.JobStatus)
112
113
	if o.Type != nil {
114
		result.Type = *o.Type
115
	}
116
117
	if o.CompletedPieces != nil {
118
		result.CompletedPieces = *o.CompletedPieces
119
	}
120
	if o.CompletionDate != nil {
121
		result.CompletionDate = *o.CompletionDate
122
	}
123
	if o.FailedPieces != nil {
124
		result.FailedPieces = *o.FailedPieces
125
	}
126
127
	result.Failures = o.Failures
128
129
	if o.TotalFailures != nil {
130
		result.TotalFailures = *o.TotalFailures
131
	}
132
	if o.TotalPieces != nil {
133
		result.TotalPieces = *o.TotalPieces
134
	}
135
	if o.TotalProcessed != nil {
136
		result.TotalProcessed = *o.TotalProcessed
137
	}
138
	return result
139
}
140
141
type ImportJobResource struct {
0 ignored issues
show
introduced by
exported type ImportJobResource should have comment or be unexported
Loading history...
142
	Format  Format
143
	RoleARN string
144
	S3URL   string
145
146
	// optional
147
	DefineSegment     bool
148
	ExternalID        string
149
	RegisterEndpoints bool
150
	SegmentID         string
151
	SegmentName       string
152
}
153
154
func newImportJobResource(o *SDK.ImportJobResource) ImportJobResource {
155
	result := ImportJobResource{}
156
	if o == nil {
157
		return result
158
	}
159
160
	result.Format = Format(o.Format)
161
162
	if o.RoleArn != nil {
163
		result.RoleARN = *o.RoleArn
164
	}
165
	if o.S3Url != nil {
166
		result.S3URL = *o.S3Url
167
	}
168
169
	if o.DefineSegment != nil {
170
		result.DefineSegment = *o.DefineSegment
171
	}
172
	if o.ExternalId != nil {
173
		result.ExternalID = *o.ExternalId
174
	}
175
	if o.RegisterEndpoints != nil {
176
		result.RegisterEndpoints = *o.RegisterEndpoints
177
	}
178
	if o.SegmentId != nil {
179
		result.SegmentID = *o.SegmentId
180
	}
181
	if o.SegmentName != nil {
182
		result.SegmentName = *o.SegmentName
183
	}
184
	return result
185
}
186