1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package mediapackage
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/mediapackage/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates a new HarvestJob record.
15func (c *Client) CreateHarvestJob(ctx context.Context, params *CreateHarvestJobInput, optFns ...func(*Options)) (*CreateHarvestJobOutput, error) {
16	if params == nil {
17		params = &CreateHarvestJobInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "CreateHarvestJob", params, optFns, addOperationCreateHarvestJobMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*CreateHarvestJobOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30// Configuration parameters used to create a new HarvestJob.
31type CreateHarvestJobInput struct {
32
33	// The end of the time-window which will be harvested
34	//
35	// This member is required.
36	EndTime *string
37
38	// The ID of the HarvestJob. The ID must be unique within the region and it cannot
39	// be changed after the HarvestJob is submitted
40	//
41	// This member is required.
42	Id *string
43
44	// The ID of the OriginEndpoint that the HarvestJob will harvest from. This cannot
45	// be changed after the HarvestJob is submitted.
46	//
47	// This member is required.
48	OriginEndpointId *string
49
50	// Configuration parameters for where in an S3 bucket to place the harvested
51	// content
52	//
53	// This member is required.
54	S3Destination *types.S3Destination
55
56	// The start of the time-window which will be harvested
57	//
58	// This member is required.
59	StartTime *string
60}
61
62type CreateHarvestJobOutput struct {
63
64	// The Amazon Resource Name (ARN) assigned to the HarvestJob.
65	Arn *string
66
67	// The ID of the Channel that the HarvestJob will harvest from.
68	ChannelId *string
69
70	// The time the HarvestJob was submitted
71	CreatedAt *string
72
73	// The end of the time-window which will be harvested.
74	EndTime *string
75
76	// The ID of the HarvestJob. The ID must be unique within the region and it cannot
77	// be changed after the HarvestJob is submitted.
78	Id *string
79
80	// The ID of the OriginEndpoint that the HarvestJob will harvest from. This cannot
81	// be changed after the HarvestJob is submitted.
82	OriginEndpointId *string
83
84	// Configuration parameters for where in an S3 bucket to place the harvested
85	// content
86	S3Destination *types.S3Destination
87
88	// The start of the time-window which will be harvested.
89	StartTime *string
90
91	// The current status of the HarvestJob. Consider setting up a CloudWatch Event to
92	// listen for HarvestJobs as they succeed or fail. In the event of failure, the
93	// CloudWatch Event will include an explanation of why the HarvestJob failed.
94	Status types.Status
95
96	// Metadata pertaining to the operation's result.
97	ResultMetadata middleware.Metadata
98}
99
100func addOperationCreateHarvestJobMiddlewares(stack *middleware.Stack, options Options) (err error) {
101	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateHarvestJob{}, middleware.After)
102	if err != nil {
103		return err
104	}
105	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateHarvestJob{}, middleware.After)
106	if err != nil {
107		return err
108	}
109	if err = addSetLoggerMiddleware(stack, options); err != nil {
110		return err
111	}
112	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
113		return err
114	}
115	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
116		return err
117	}
118	if err = addResolveEndpointMiddleware(stack, options); err != nil {
119		return err
120	}
121	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
122		return err
123	}
124	if err = addRetryMiddlewares(stack, options); err != nil {
125		return err
126	}
127	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
128		return err
129	}
130	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
131		return err
132	}
133	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
134		return err
135	}
136	if err = addClientUserAgent(stack); err != nil {
137		return err
138	}
139	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
140		return err
141	}
142	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
143		return err
144	}
145	if err = addOpCreateHarvestJobValidationMiddleware(stack); err != nil {
146		return err
147	}
148	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateHarvestJob(options.Region), middleware.Before); err != nil {
149		return err
150	}
151	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
152		return err
153	}
154	if err = addResponseErrorMiddleware(stack); err != nil {
155		return err
156	}
157	if err = addRequestResponseLogging(stack, options); err != nil {
158		return err
159	}
160	return nil
161}
162
163func newServiceMetadataMiddleware_opCreateHarvestJob(region string) *awsmiddleware.RegisterServiceMetadata {
164	return &awsmiddleware.RegisterServiceMetadata{
165		Region:        region,
166		ServiceID:     ServiceID,
167		SigningName:   "mediapackage",
168		OperationName: "CreateHarvestJob",
169	}
170}
171