1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package personalize
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/personalize/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates a batch inference job. The operation can handle up to 50 million records
15// and the input file must be in JSON format. For more information, see
16// recommendations-batch.
17func (c *Client) CreateBatchInferenceJob(ctx context.Context, params *CreateBatchInferenceJobInput, optFns ...func(*Options)) (*CreateBatchInferenceJobOutput, error) {
18	if params == nil {
19		params = &CreateBatchInferenceJobInput{}
20	}
21
22	result, metadata, err := c.invokeOperation(ctx, "CreateBatchInferenceJob", params, optFns, addOperationCreateBatchInferenceJobMiddlewares)
23	if err != nil {
24		return nil, err
25	}
26
27	out := result.(*CreateBatchInferenceJobOutput)
28	out.ResultMetadata = metadata
29	return out, nil
30}
31
32type CreateBatchInferenceJobInput struct {
33
34	// The Amazon S3 path that leads to the input file to base your recommendations on.
35	// The input material must be in JSON format.
36	//
37	// This member is required.
38	JobInput *types.BatchInferenceJobInput
39
40	// The name of the batch inference job to create.
41	//
42	// This member is required.
43	JobName *string
44
45	// The path to the Amazon S3 bucket where the job's output will be stored.
46	//
47	// This member is required.
48	JobOutput *types.BatchInferenceJobOutput
49
50	// The ARN of the Amazon Identity and Access Management role that has permissions
51	// to read and write to your input and out Amazon S3 buckets respectively.
52	//
53	// This member is required.
54	RoleArn *string
55
56	// The Amazon Resource Name (ARN) of the solution version that will be used to
57	// generate the batch inference recommendations.
58	//
59	// This member is required.
60	SolutionVersionArn *string
61
62	// The configuration details of a batch inference job.
63	BatchInferenceJobConfig *types.BatchInferenceJobConfig
64
65	// The ARN of the filter to apply to the batch inference job. For more information
66	// on using filters, see Using Filters with Amazon Personalize.
67	FilterArn *string
68
69	// The number of recommendations to retreive.
70	NumResults *int32
71}
72
73type CreateBatchInferenceJobOutput struct {
74
75	// The ARN of the batch inference job.
76	BatchInferenceJobArn *string
77
78	// Metadata pertaining to the operation's result.
79	ResultMetadata middleware.Metadata
80}
81
82func addOperationCreateBatchInferenceJobMiddlewares(stack *middleware.Stack, options Options) (err error) {
83	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateBatchInferenceJob{}, middleware.After)
84	if err != nil {
85		return err
86	}
87	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateBatchInferenceJob{}, middleware.After)
88	if err != nil {
89		return err
90	}
91	if err = addSetLoggerMiddleware(stack, options); err != nil {
92		return err
93	}
94	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
95		return err
96	}
97	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
98		return err
99	}
100	if err = addResolveEndpointMiddleware(stack, options); err != nil {
101		return err
102	}
103	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
104		return err
105	}
106	if err = addRetryMiddlewares(stack, options); err != nil {
107		return err
108	}
109	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
110		return err
111	}
112	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
113		return err
114	}
115	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
116		return err
117	}
118	if err = addClientUserAgent(stack); err != nil {
119		return err
120	}
121	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
122		return err
123	}
124	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
125		return err
126	}
127	if err = addOpCreateBatchInferenceJobValidationMiddleware(stack); err != nil {
128		return err
129	}
130	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateBatchInferenceJob(options.Region), middleware.Before); err != nil {
131		return err
132	}
133	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
134		return err
135	}
136	if err = addResponseErrorMiddleware(stack); err != nil {
137		return err
138	}
139	if err = addRequestResponseLogging(stack, options); err != nil {
140		return err
141	}
142	return nil
143}
144
145func newServiceMetadataMiddleware_opCreateBatchInferenceJob(region string) *awsmiddleware.RegisterServiceMetadata {
146	return &awsmiddleware.RegisterServiceMetadata{
147		Region:        region,
148		ServiceID:     ServiceID,
149		SigningName:   "personalize",
150		OperationName: "CreateBatchInferenceJob",
151	}
152}
153