1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package mediaconvert
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/mediaconvert/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Create a new job template. For information about job templates see the User
15// Guide at http://docs.aws.amazon.com/mediaconvert/latest/ug/what-is.html
16func (c *Client) CreateJobTemplate(ctx context.Context, params *CreateJobTemplateInput, optFns ...func(*Options)) (*CreateJobTemplateOutput, error) {
17	if params == nil {
18		params = &CreateJobTemplateInput{}
19	}
20
21	result, metadata, err := c.invokeOperation(ctx, "CreateJobTemplate", params, optFns, addOperationCreateJobTemplateMiddlewares)
22	if err != nil {
23		return nil, err
24	}
25
26	out := result.(*CreateJobTemplateOutput)
27	out.ResultMetadata = metadata
28	return out, nil
29}
30
31type CreateJobTemplateInput struct {
32
33	// The name of the job template you are creating.
34	//
35	// This member is required.
36	Name *string
37
38	// JobTemplateSettings contains all the transcode settings saved in the template
39	// that will be applied to jobs created from it.
40	//
41	// This member is required.
42	Settings *types.JobTemplateSettings
43
44	// Accelerated transcoding can significantly speed up jobs with long, visually
45	// complex content. Outputs that use this feature incur pro-tier pricing. For
46	// information about feature limitations, see the AWS Elemental MediaConvert User
47	// Guide.
48	AccelerationSettings *types.AccelerationSettings
49
50	// Optional. A category for the job template you are creating
51	Category *string
52
53	// Optional. A description of the job template you are creating.
54	Description *string
55
56	// Optional. Use queue hopping to avoid overly long waits in the backlog of the
57	// queue that you submit your job to. Specify an alternate queue and the maximum
58	// time that your job will wait in the initial queue before hopping. For more
59	// information about this feature, see the AWS Elemental MediaConvert User Guide.
60	HopDestinations []types.HopDestination
61
62	// Specify the relative priority for this job. In any given queue, the service
63	// begins processing the job with the highest value first. When more than one job
64	// has the same priority, the service begins processing the job that you submitted
65	// first. If you don't specify a priority, the service uses the default value 0.
66	Priority int32
67
68	// Optional. The queue that jobs created from this template are assigned to. If you
69	// don't specify this, jobs will go to the default queue.
70	Queue *string
71
72	// Specify how often MediaConvert sends STATUS_UPDATE events to Amazon CloudWatch
73	// Events. Set the interval, in seconds, between status updates. MediaConvert sends
74	// an update at this interval from the time the service begins processing your job
75	// to the time it completes the transcode or encounters an error.
76	StatusUpdateInterval types.StatusUpdateInterval
77
78	// The tags that you want to add to the resource. You can tag resources with a
79	// key-value pair or with only a key.
80	Tags map[string]string
81}
82
83type CreateJobTemplateOutput struct {
84
85	// A job template is a pre-made set of encoding instructions that you can use to
86	// quickly create a job.
87	JobTemplate *types.JobTemplate
88
89	// Metadata pertaining to the operation's result.
90	ResultMetadata middleware.Metadata
91}
92
93func addOperationCreateJobTemplateMiddlewares(stack *middleware.Stack, options Options) (err error) {
94	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateJobTemplate{}, middleware.After)
95	if err != nil {
96		return err
97	}
98	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateJobTemplate{}, middleware.After)
99	if err != nil {
100		return err
101	}
102	if err = addSetLoggerMiddleware(stack, options); err != nil {
103		return err
104	}
105	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
106		return err
107	}
108	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
109		return err
110	}
111	if err = addResolveEndpointMiddleware(stack, options); err != nil {
112		return err
113	}
114	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
115		return err
116	}
117	if err = addRetryMiddlewares(stack, options); err != nil {
118		return err
119	}
120	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
121		return err
122	}
123	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
124		return err
125	}
126	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
127		return err
128	}
129	if err = addClientUserAgent(stack); err != nil {
130		return err
131	}
132	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
133		return err
134	}
135	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
136		return err
137	}
138	if err = addOpCreateJobTemplateValidationMiddleware(stack); err != nil {
139		return err
140	}
141	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateJobTemplate(options.Region), middleware.Before); err != nil {
142		return err
143	}
144	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
145		return err
146	}
147	if err = addResponseErrorMiddleware(stack); err != nil {
148		return err
149	}
150	if err = addRequestResponseLogging(stack, options); err != nil {
151		return err
152	}
153	return nil
154}
155
156func newServiceMetadataMiddleware_opCreateJobTemplate(region string) *awsmiddleware.RegisterServiceMetadata {
157	return &awsmiddleware.RegisterServiceMetadata{
158		Region:        region,
159		ServiceID:     ServiceID,
160		SigningName:   "mediaconvert",
161		OperationName: "CreateJobTemplate",
162	}
163}
164