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

pinpoint/client_op_update_endpoint.go   A

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 8
eloc 39
dl 0
loc 62
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A pinpoint.NewUpdateEndpointResult 0 12 3
A pinpoint.UpdateEndpointRequest.ToInput 0 11 3
A pinpoint.*Pinpoint.UpdateEndpoint 0 11 2
1
package pinpoint
2
3
import (
4
	"context"
5
6
	SDK "github.com/aws/aws-sdk-go-v2/service/pinpoint"
7
8
	"github.com/evalphobia/aws-sdk-go-v2-wrapper/errors"
9
	"github.com/evalphobia/aws-sdk-go-v2-wrapper/private/pointers"
10
)
11
12
// UpdateEndpoint executes `UpdateEndpoint` operation.
13
func (svc *Pinpoint) UpdateEndpoint(ctx context.Context, r UpdateEndpointRequest) (*UpdateEndpointResult, error) {
14
	out, err := svc.RawUpdateEndpoint(ctx, r.ToInput())
15
	if err != nil {
16
		err = svc.errWrap(errors.ErrorData{
17
			Err:          err,
18
			AWSOperation: "UpdateEndpoint",
19
		})
20
		svc.Errorf(err.Error())
0 ignored issues
show
introduced by
can't check non-constant format in call to Errorf
Loading history...
21
		return nil, err
22
	}
23
	return NewUpdateEndpointResult(out), nil
24
}
25
26
// UpdateEndpointRequest has parameters for `UpdateEndpoint` operation.
27
type UpdateEndpointRequest struct {
28
	ApplicationID   string
29
	EndpointID      string
30
	EndpointRequest EndpointRequest
31
}
32
33
func (r UpdateEndpointRequest) ToInput() *SDK.UpdateEndpointInput {
0 ignored issues
show
introduced by
exported method UpdateEndpointRequest.ToInput should have comment or be unexported
Loading history...
34
	in := &SDK.UpdateEndpointInput{}
35
	if r.ApplicationID != "" {
36
		in.ApplicationId = pointers.String(r.ApplicationID)
37
	}
38
	if r.EndpointID != "" {
39
		in.EndpointId = pointers.String(r.EndpointID)
40
	}
41
42
	in.EndpointRequest = r.EndpointRequest.ToSDK()
43
	return in
44
}
45
46
type UpdateEndpointResult struct {
0 ignored issues
show
introduced by
exported type UpdateEndpointResult should have comment or be unexported
Loading history...
47
	Message   string
48
	RequestID string
49
}
50
51
func NewUpdateEndpointResult(o *SDK.UpdateEndpointResponse) *UpdateEndpointResult {
0 ignored issues
show
introduced by
exported function NewUpdateEndpointResult should have comment or be unexported
Loading history...
52
	result := &UpdateEndpointResult{}
53
	if o == nil {
54
		return result
55
	}
56
57
	if o.MessageBody != nil {
58
		v := o.MessageBody
59
		result.Message = *v.Message
60
		result.RequestID = *v.RequestID
61
	}
62
	return result
63
}
64