Passed
Pull Request — master (#29)
by eval
02:10
created

pinpoint.*Pinpoint.DeletePushTemplate   A

Complexity

Conditions 2

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 9
nop 2
dl 0
loc 11
rs 9.95
c 0
b 0
f 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
// DeletePushTemplate executes `DeletePushTemplate` operation.
13
func (svc *Pinpoint) DeletePushTemplate(ctx context.Context, r DeletePushTemplateRequest) (*DeletePushTemplateResult, error) {
14
	out, err := svc.RawDeletePushTemplate(ctx, r.ToInput())
15
	if err != nil {
16
		err = svc.errWrap(errors.ErrorData{
17
			Err:          err,
18
			AWSOperation: "DeletePushTemplate",
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 NewDeletePushTemplateResult(out), nil
24
}
25
26
// DeletePushTemplateRequest has parameters for `DeletePushTemplate` operation.
27
type DeletePushTemplateRequest struct {
28
	TemplateName string
29
30
	// optional
31
	Version string
32
}
33
34
func (r DeletePushTemplateRequest) ToInput() *SDK.DeletePushTemplateInput {
0 ignored issues
show
introduced by
exported method DeletePushTemplateRequest.ToInput should have comment or be unexported
Loading history...
35
	in := &SDK.DeletePushTemplateInput{}
36
	if r.TemplateName != "" {
37
		in.TemplateName = pointers.String(r.TemplateName)
38
	}
39
	if r.Version != "" {
40
		in.Version = pointers.String(r.Version)
41
	}
42
	return in
43
}
44
45
type DeletePushTemplateResult struct {
0 ignored issues
show
introduced by
exported type DeletePushTemplateResult should have comment or be unexported
Loading history...
46
	MessageBody
47
}
48
49
func NewDeletePushTemplateResult(o *SDK.DeletePushTemplateResponse) *DeletePushTemplateResult {
0 ignored issues
show
introduced by
exported function NewDeletePushTemplateResult should have comment or be unexported
Loading history...
50
	result := &DeletePushTemplateResult{}
51
	if o == nil {
52
		return result
53
	}
54
55
	result.MessageBody = newMessageBody(o.MessageBody)
56
	return result
57
}
58