1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package forecast
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/forecast/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates a forecast for each item in the TARGET_TIME_SERIES dataset that was used
15// to train the predictor. This is known as inference. To retrieve the forecast for
16// a single item at low latency, use the operation. To export the complete forecast
17// into your Amazon Simple Storage Service (Amazon S3) bucket, use the
18// CreateForecastExportJob operation. The range of the forecast is determined by
19// the ForecastHorizon value, which you specify in the CreatePredictor request.
20// When you query a forecast, you can request a specific date range within the
21// forecast. To get a list of all your forecasts, use the ListForecasts operation.
22// The forecasts generated by Amazon Forecast are in the same time zone as the
23// dataset that was used to create the predictor. For more information, see
24// howitworks-forecast. The Status of the forecast must be ACTIVE before you can
25// query or export the forecast. Use the DescribeForecast operation to get the
26// status.
27func (c *Client) CreateForecast(ctx context.Context, params *CreateForecastInput, optFns ...func(*Options)) (*CreateForecastOutput, error) {
28	if params == nil {
29		params = &CreateForecastInput{}
30	}
31
32	result, metadata, err := c.invokeOperation(ctx, "CreateForecast", params, optFns, addOperationCreateForecastMiddlewares)
33	if err != nil {
34		return nil, err
35	}
36
37	out := result.(*CreateForecastOutput)
38	out.ResultMetadata = metadata
39	return out, nil
40}
41
42type CreateForecastInput struct {
43
44	// A name for the forecast.
45	//
46	// This member is required.
47	ForecastName *string
48
49	// The Amazon Resource Name (ARN) of the predictor to use to generate the forecast.
50	//
51	// This member is required.
52	PredictorArn *string
53
54	// The quantiles at which probabilistic forecasts are generated. You can currently
55	// specify up to 5 quantiles per forecast. Accepted values include 0.01 to 0.99
56	// (increments of .01 only) and mean. The mean forecast is different from the
57	// median (0.50) when the distribution is not symmetric (for example, Beta and
58	// Negative Binomial). The default value is ["0.1", "0.5", "0.9"].
59	ForecastTypes []string
60
61	// The optional metadata that you apply to the forecast to help you categorize and
62	// organize them. Each tag consists of a key and an optional value, both of which
63	// you define. The following basic restrictions apply to tags:
64	//
65	// * Maximum number of
66	// tags per resource - 50.
67	//
68	// * For each resource, each tag key must be unique, and
69	// each tag key can have only one value.
70	//
71	// * Maximum key length - 128 Unicode
72	// characters in UTF-8.
73	//
74	// * Maximum value length - 256 Unicode characters in
75	// UTF-8.
76	//
77	// * If your tagging schema is used across multiple services and resources,
78	// remember that other services may have restrictions on allowed characters.
79	// Generally allowed characters are: letters, numbers, and spaces representable in
80	// UTF-8, and the following characters: + - = . _ : / @.
81	//
82	// * Tag keys and values are
83	// case sensitive.
84	//
85	// * Do not use aws:, AWS:, or any upper or lowercase combination
86	// of such as a prefix for keys as it is reserved for AWS use. You cannot edit or
87	// delete tag keys with this prefix. Values can have this prefix. If a tag value
88	// has aws as its prefix but the key does not, then Forecast considers it to be a
89	// user tag and will count against the limit of 50 tags. Tags with only the key
90	// prefix of aws do not count against your tags per resource limit.
91	Tags []types.Tag
92}
93
94type CreateForecastOutput struct {
95
96	// The Amazon Resource Name (ARN) of the forecast.
97	ForecastArn *string
98
99	// Metadata pertaining to the operation's result.
100	ResultMetadata middleware.Metadata
101}
102
103func addOperationCreateForecastMiddlewares(stack *middleware.Stack, options Options) (err error) {
104	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateForecast{}, middleware.After)
105	if err != nil {
106		return err
107	}
108	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateForecast{}, middleware.After)
109	if err != nil {
110		return err
111	}
112	if err = addSetLoggerMiddleware(stack, options); err != nil {
113		return err
114	}
115	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
116		return err
117	}
118	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
119		return err
120	}
121	if err = addResolveEndpointMiddleware(stack, options); err != nil {
122		return err
123	}
124	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
125		return err
126	}
127	if err = addRetryMiddlewares(stack, options); err != nil {
128		return err
129	}
130	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
131		return err
132	}
133	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
134		return err
135	}
136	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
137		return err
138	}
139	if err = addClientUserAgent(stack); err != nil {
140		return err
141	}
142	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
143		return err
144	}
145	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
146		return err
147	}
148	if err = addOpCreateForecastValidationMiddleware(stack); err != nil {
149		return err
150	}
151	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateForecast(options.Region), middleware.Before); err != nil {
152		return err
153	}
154	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
155		return err
156	}
157	if err = addResponseErrorMiddleware(stack); err != nil {
158		return err
159	}
160	if err = addRequestResponseLogging(stack, options); err != nil {
161		return err
162	}
163	return nil
164}
165
166func newServiceMetadataMiddleware_opCreateForecast(region string) *awsmiddleware.RegisterServiceMetadata {
167	return &awsmiddleware.RegisterServiceMetadata{
168		Region:        region,
169		ServiceID:     ServiceID,
170		SigningName:   "forecast",
171		OperationName: "CreateForecast",
172	}
173}
174