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

pinpoint/client_op_get_endpoint.go   A

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 7
eloc 33
dl 0
loc 54
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A pinpoint.NewGetEndpointResult 0 8 2
A pinpoint.GetEndpointRequest.ToInput 0 9 3
A pinpoint.*Pinpoint.GetEndpoint 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
// GetEndpoint executes `GetEndpoint` operation.
13
func (svc *Pinpoint) GetEndpoint(ctx context.Context, r GetEndpointRequest) (*GetEndpointResult, error) {
14
	out, err := svc.RawGetEndpoint(ctx, r.ToInput())
15
	if err != nil {
16
		err = svc.errWrap(errors.ErrorData{
17
			Err:          err,
18
			AWSOperation: "GetEndpoint",
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 NewGetEndpointResult(out), nil
24
}
25
26
// GetEndpointRequest has parameters for `GetEndpoint` operation.
27
type GetEndpointRequest struct {
28
	ApplicationID string
29
	EndpointID    string
30
}
31
32
func (r GetEndpointRequest) ToInput() *SDK.GetEndpointInput {
0 ignored issues
show
introduced by
exported method GetEndpointRequest.ToInput should have comment or be unexported
Loading history...
33
	in := &SDK.GetEndpointInput{}
34
	if r.ApplicationID != "" {
35
		in.ApplicationId = pointers.String(r.ApplicationID)
36
	}
37
	if r.EndpointID != "" {
38
		in.EndpointId = pointers.String(r.EndpointID)
39
	}
40
	return in
41
}
42
43
type GetEndpointResult struct {
0 ignored issues
show
introduced by
exported type GetEndpointResult should have comment or be unexported
Loading history...
44
	EndpointResponse
45
}
46
47
func NewGetEndpointResult(o *SDK.GetEndpointResponse) *GetEndpointResult {
0 ignored issues
show
introduced by
exported function NewGetEndpointResult should have comment or be unexported
Loading history...
48
	result := &GetEndpointResult{}
49
	if o == nil {
50
		return result
51
	}
52
53
	result.EndpointResponse = newEndpointResponse(o.EndpointResponse)
54
	return result
55
}
56