| Total Lines | 62 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 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()) |
||
|
|
|||
| 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 { |
||
| 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 { |
||
| 47 | Message string |
||
| 48 | RequestID string |
||
| 49 | } |
||
| 50 | |||
| 51 | func NewUpdateEndpointResult(o *SDK.UpdateEndpointResponse) *UpdateEndpointResult { |
||
| 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 |