1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package pinpoint
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/pinpoint/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Retrieves the content and settings of a message template for messages that are
15// sent through a push notification channel.
16func (c *Client) GetPushTemplate(ctx context.Context, params *GetPushTemplateInput, optFns ...func(*Options)) (*GetPushTemplateOutput, error) {
17	if params == nil {
18		params = &GetPushTemplateInput{}
19	}
20
21	result, metadata, err := c.invokeOperation(ctx, "GetPushTemplate", params, optFns, addOperationGetPushTemplateMiddlewares)
22	if err != nil {
23		return nil, err
24	}
25
26	out := result.(*GetPushTemplateOutput)
27	out.ResultMetadata = metadata
28	return out, nil
29}
30
31type GetPushTemplateInput struct {
32
33	// The name of the message template. A template name must start with an
34	// alphanumeric character and can contain a maximum of 128 characters. The
35	// characters can be alphanumeric characters, underscores (_), or hyphens (-).
36	// Template names are case sensitive.
37	//
38	// This member is required.
39	TemplateName *string
40
41	// The unique identifier for the version of the message template to update,
42	// retrieve information about, or delete. To retrieve identifiers and other
43	// information for all the versions of a template, use the Template Versions
44	// resource. If specified, this value must match the identifier for an existing
45	// template version. If specified for an update operation, this value must match
46	// the identifier for the latest existing version of the template. This restriction
47	// helps ensure that race conditions don't occur. If you don't specify a value for
48	// this parameter, Amazon Pinpoint does the following:
49	//
50	// * For a get operation,
51	// retrieves information about the active version of the template.
52	//
53	// * For an update
54	// operation, saves the updates to (overwrites) the latest existing version of the
55	// template, if the create-new-version parameter isn't used or is set to false.
56	//
57	// *
58	// For a delete operation, deletes the template, including all versions of the
59	// template.
60	Version *string
61}
62
63type GetPushTemplateOutput struct {
64
65	// Provides information about the content and settings for a message template that
66	// can be used in messages that are sent through a push notification channel.
67	//
68	// This member is required.
69	PushNotificationTemplateResponse *types.PushNotificationTemplateResponse
70
71	// Metadata pertaining to the operation's result.
72	ResultMetadata middleware.Metadata
73}
74
75func addOperationGetPushTemplateMiddlewares(stack *middleware.Stack, options Options) (err error) {
76	err = stack.Serialize.Add(&awsRestjson1_serializeOpGetPushTemplate{}, middleware.After)
77	if err != nil {
78		return err
79	}
80	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetPushTemplate{}, middleware.After)
81	if err != nil {
82		return err
83	}
84	if err = addSetLoggerMiddleware(stack, options); err != nil {
85		return err
86	}
87	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
88		return err
89	}
90	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
91		return err
92	}
93	if err = addResolveEndpointMiddleware(stack, options); err != nil {
94		return err
95	}
96	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
97		return err
98	}
99	if err = addRetryMiddlewares(stack, options); err != nil {
100		return err
101	}
102	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
103		return err
104	}
105	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
106		return err
107	}
108	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
109		return err
110	}
111	if err = addClientUserAgent(stack); err != nil {
112		return err
113	}
114	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
115		return err
116	}
117	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
118		return err
119	}
120	if err = addOpGetPushTemplateValidationMiddleware(stack); err != nil {
121		return err
122	}
123	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetPushTemplate(options.Region), middleware.Before); err != nil {
124		return err
125	}
126	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
127		return err
128	}
129	if err = addResponseErrorMiddleware(stack); err != nil {
130		return err
131	}
132	if err = addRequestResponseLogging(stack, options); err != nil {
133		return err
134	}
135	return nil
136}
137
138func newServiceMetadataMiddleware_opGetPushTemplate(region string) *awsmiddleware.RegisterServiceMetadata {
139	return &awsmiddleware.RegisterServiceMetadata{
140		Region:        region,
141		ServiceID:     ServiceID,
142		SigningName:   "mobiletargeting",
143		OperationName: "GetPushTemplate",
144	}
145}
146