Skip to content

Commit

Permalink
feat(client-forecast): New APIs for Monitor that help you understand …
Browse files Browse the repository at this point in the history
…how your predictors perform over time.
  • Loading branch information
awstools committed May 23, 2022
1 parent ac8f021 commit 74fa9b8
Show file tree
Hide file tree
Showing 32 changed files with 3,562 additions and 224 deletions.
355 changes: 310 additions & 45 deletions clients/client-forecast/src/Forecast.ts

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions clients/client-forecast/src/ForecastClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ import {
CreateForecastExportJobCommandInput,
CreateForecastExportJobCommandOutput,
} from "./commands/CreateForecastExportJobCommand";
import { CreateMonitorCommandInput, CreateMonitorCommandOutput } from "./commands/CreateMonitorCommand";
import {
CreatePredictorBacktestExportJobCommandInput,
CreatePredictorBacktestExportJobCommandOutput,
Expand All @@ -99,6 +100,7 @@ import {
DeleteForecastExportJobCommandInput,
DeleteForecastExportJobCommandOutput,
} from "./commands/DeleteForecastExportJobCommand";
import { DeleteMonitorCommandInput, DeleteMonitorCommandOutput } from "./commands/DeleteMonitorCommand";
import {
DeletePredictorBacktestExportJobCommandInput,
DeletePredictorBacktestExportJobCommandOutput,
Expand Down Expand Up @@ -131,6 +133,7 @@ import {
DescribeForecastExportJobCommandInput,
DescribeForecastExportJobCommandOutput,
} from "./commands/DescribeForecastExportJobCommand";
import { DescribeMonitorCommandInput, DescribeMonitorCommandOutput } from "./commands/DescribeMonitorCommand";
import {
DescribePredictorBacktestExportJobCommandInput,
DescribePredictorBacktestExportJobCommandOutput,
Expand All @@ -156,6 +159,11 @@ import {
ListForecastExportJobsCommandOutput,
} from "./commands/ListForecastExportJobsCommand";
import { ListForecastsCommandInput, ListForecastsCommandOutput } from "./commands/ListForecastsCommand";
import {
ListMonitorEvaluationsCommandInput,
ListMonitorEvaluationsCommandOutput,
} from "./commands/ListMonitorEvaluationsCommand";
import { ListMonitorsCommandInput, ListMonitorsCommandOutput } from "./commands/ListMonitorsCommand";
import {
ListPredictorBacktestExportJobsCommandInput,
ListPredictorBacktestExportJobsCommandOutput,
Expand All @@ -165,6 +173,7 @@ import {
ListTagsForResourceCommandInput,
ListTagsForResourceCommandOutput,
} from "./commands/ListTagsForResourceCommand";
import { ResumeResourceCommandInput, ResumeResourceCommandOutput } from "./commands/ResumeResourceCommand";
import { StopResourceCommandInput, StopResourceCommandOutput } from "./commands/StopResourceCommand";
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
Expand All @@ -180,6 +189,7 @@ export type ServiceInputTypes =
| CreateExplainabilityExportCommandInput
| CreateForecastCommandInput
| CreateForecastExportJobCommandInput
| CreateMonitorCommandInput
| CreatePredictorBacktestExportJobCommandInput
| CreatePredictorCommandInput
| DeleteDatasetCommandInput
Expand All @@ -189,6 +199,7 @@ export type ServiceInputTypes =
| DeleteExplainabilityExportCommandInput
| DeleteForecastCommandInput
| DeleteForecastExportJobCommandInput
| DeleteMonitorCommandInput
| DeletePredictorBacktestExportJobCommandInput
| DeletePredictorCommandInput
| DeleteResourceTreeCommandInput
Expand All @@ -200,6 +211,7 @@ export type ServiceInputTypes =
| DescribeExplainabilityExportCommandInput
| DescribeForecastCommandInput
| DescribeForecastExportJobCommandInput
| DescribeMonitorCommandInput
| DescribePredictorBacktestExportJobCommandInput
| DescribePredictorCommandInput
| GetAccuracyMetricsCommandInput
Expand All @@ -210,9 +222,12 @@ export type ServiceInputTypes =
| ListExplainabilityExportsCommandInput
| ListForecastExportJobsCommandInput
| ListForecastsCommandInput
| ListMonitorEvaluationsCommandInput
| ListMonitorsCommandInput
| ListPredictorBacktestExportJobsCommandInput
| ListPredictorsCommandInput
| ListTagsForResourceCommandInput
| ResumeResourceCommandInput
| StopResourceCommandInput
| TagResourceCommandInput
| UntagResourceCommandInput
Expand All @@ -227,6 +242,7 @@ export type ServiceOutputTypes =
| CreateExplainabilityExportCommandOutput
| CreateForecastCommandOutput
| CreateForecastExportJobCommandOutput
| CreateMonitorCommandOutput
| CreatePredictorBacktestExportJobCommandOutput
| CreatePredictorCommandOutput
| DeleteDatasetCommandOutput
Expand All @@ -236,6 +252,7 @@ export type ServiceOutputTypes =
| DeleteExplainabilityExportCommandOutput
| DeleteForecastCommandOutput
| DeleteForecastExportJobCommandOutput
| DeleteMonitorCommandOutput
| DeletePredictorBacktestExportJobCommandOutput
| DeletePredictorCommandOutput
| DeleteResourceTreeCommandOutput
Expand All @@ -247,6 +264,7 @@ export type ServiceOutputTypes =
| DescribeExplainabilityExportCommandOutput
| DescribeForecastCommandOutput
| DescribeForecastExportJobCommandOutput
| DescribeMonitorCommandOutput
| DescribePredictorBacktestExportJobCommandOutput
| DescribePredictorCommandOutput
| GetAccuracyMetricsCommandOutput
Expand All @@ -257,9 +275,12 @@ export type ServiceOutputTypes =
| ListExplainabilityExportsCommandOutput
| ListForecastExportJobsCommandOutput
| ListForecastsCommandOutput
| ListMonitorEvaluationsCommandOutput
| ListMonitorsCommandOutput
| ListPredictorBacktestExportJobsCommandOutput
| ListPredictorsCommandOutput
| ListTagsForResourceCommandOutput
| ResumeResourceCommandOutput
| StopResourceCommandOutput
| TagResourceCommandOutput
| UntagResourceCommandOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ export interface CreateAutoPredictorCommandOutput extends CreateAutoPredictorRes
* <p>Creates an Amazon Forecast predictor.</p>
* <p>Amazon Forecast creates predictors with AutoPredictor, which involves applying the
* optimal combination of algorithms to each time series in your datasets. You can use
* <a>CreateAutoPredictor</a> to create new predictors or upgrade/retrain existing
* predictors.</p>
* <a>CreateAutoPredictor</a> to create new predictors or upgrade/retrain
* existing predictors.</p>
*
* <p>
* <b>Creating new predictors</b>
* </p>
*
* <p>The following parameters are required when creating a new predictor:</p>
* <ul>
* <li>
Expand All @@ -49,15 +51,15 @@ export interface CreateAutoPredictorCommandOutput extends CreateAutoPredictorRes
* </li>
* <li>
* <p>
* <code>ForecastHorizon</code> - The number of time steps being
* forecasted.</p>
* <code>ForecastHorizon</code> - The number of time-steps that the model
* predicts. The forecast horizon is also called the prediction length.</p>
* </li>
* </ul>
* <p>When creating a new predictor, do not specify a value for
* <code>ReferencePredictorArn</code>.</p>
* <p>
* <b>Upgrading and retraining predictors</b>
* </p>
* </p>
* <p>The following parameters are required when retraining or upgrading a predictor:</p>
* <ul>
* <li>
Expand Down
8 changes: 4 additions & 4 deletions clients/client-forecast/src/commands/CreateDatasetCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ export interface CreateDatasetCommandOutput extends CreateDatasetResponse, __Met
* </ul>
* <p>After creating a dataset, you import your training data into it and add the dataset to a
* dataset group. You use the dataset group to create a predictor. For more information, see
* <a>howitworks-datasets-groups</a>.</p>
* <p>To get a list of all your datasets, use the <a>ListDatasets</a>
* operation.</p>
* <a href="https://docs.aws.amazon.com/forecast/latest/dg/howitworks-datasets-groups.html">Importing datasets</a>.</p>
* <p>To get a list of all your datasets, use the <a href="https://docs.aws.amazon.com/forecast/latest/dg/API_ListDatasets.html">ListDatasets</a> operation.</p>
* <p>For example Forecast datasets, see the <a href="https://github.com/aws-samples/amazon-forecast-samples">Amazon Forecast Sample GitHub
* repository</a>.</p>
* <note>
* <p>The <code>Status</code> of a dataset must be <code>ACTIVE</code> before you can import
* training data. Use the <a>DescribeDataset</a> operation to get the status.</p>
* training data. Use the <a href="https://docs.aws.amazon.com/forecast/latest/dg/API_DescribeDataset.html">DescribeDataset</a> operation to get
* the status.</p>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ export interface CreateDatasetGroupCommandOutput extends CreateDatasetGroupRespo

/**
* <p>Creates a dataset group, which holds a collection of related datasets. You can add
* datasets to the dataset group when you create the dataset group, or later by using the <a>UpdateDatasetGroup</a> operation.</p>
* datasets to the dataset group when you create the dataset group, or later by using the <a href="https://docs.aws.amazon.com/forecast/latest/dg/API_UpdateDatasetGroup.html">UpdateDatasetGroup</a> operation.</p>
* <p>After creating a dataset group and adding datasets, you use the dataset group when you
* create a predictor. For more information, see <a>howitworks-datasets-groups</a>.</p>
* <p>To get a list of all your datasets groups, use the <a>ListDatasetGroups</a>
* create a predictor. For more information, see <a href="https://docs.aws.amazon.com/forecast/latest/dg/howitworks-datasets-groups.html">Dataset groups</a>.</p>
* <p>To get a list of all your datasets groups, use the <a href="https://docs.aws.amazon.com/forecast/latest/dg/API_ListDatasetGroups.html">ListDatasetGroups</a>
* operation.</p>
* <note>
* <p>The <code>Status</code> of a dataset group must be <code>ACTIVE</code> before you can
* use the dataset group to create a predictor. To get the status, use the <a>DescribeDatasetGroup</a> operation.</p>
* use the dataset group to create a predictor. To get the status, use the <a href="https://docs.aws.amazon.com/forecast/latest/dg/API_DescribeDatasetGroup.html">DescribeDatasetGroup</a> operation.</p>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ export interface CreateDatasetImportJobCommandOutput extends CreateDatasetImport
* <p>Imports your training data to an Amazon Forecast dataset. You provide the location of your
* training data in an Amazon Simple Storage Service (Amazon S3) bucket and the Amazon Resource Name (ARN) of the dataset
* that you want to import the data to.</p>
* <p>You must specify a <a>DataSource</a> object that includes an AWS Identity and Access Management (IAM)
* role that Amazon Forecast can assume to access the data, as Amazon Forecast makes a copy of your data and
* processes it in an internal AWS system. For more information, see <a>aws-forecast-iam-roles</a>.</p>
* <p>You must specify a <a href="https://docs.aws.amazon.com/forecast/latest/dg/API_DataSource.html">DataSource</a> object that includes an
* AWS Identity and Access Management (IAM) role that Amazon Forecast can assume to access the data, as Amazon Forecast makes a copy
* of your data and processes it in an internal AWS system. For more information, see <a href="https://docs.aws.amazon.com/forecast/latest/dg/aws-forecast-iam-roles.html">Set up
* permissions</a>.</p>
* <p>The training data must be in CSV format. The delimiter must be a comma (,).</p>
* <p>You can specify the path to a specific CSV file, the S3 bucket, or to a folder in the S3
* bucket. For the latter two cases, Amazon Forecast imports all files up to the limit of 10,000
Expand All @@ -42,7 +43,7 @@ export interface CreateDatasetImportJobCommandOutput extends CreateDatasetImport
*
*
* <p>To get a list of all your dataset import jobs, filtered by specified criteria, use the
* <a>ListDatasetImportJobs</a> operation.</p>
* <a href="https://docs.aws.amazon.com/forecast/latest/dg/API_ListDatasetImportJobs.html">ListDatasetImportJobs</a> operation.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface CreateExplainabilityCommandOutput extends CreateExplainabilityR
* provide a Forecast ARN.</p>
* <p>
* <b>CreateExplainability with a Predictor ARN</b>
* </p>
* </p>
* <note>
* <p>You can only have one Explainability resource per predictor. If you already
* enabled <code>ExplainPredictor</code> in <a>CreateAutoPredictor</a>, that
Expand Down Expand Up @@ -91,7 +91,7 @@ export interface CreateExplainabilityCommandOutput extends CreateExplainabilityR
* </ul>
* <p>
* <b>CreateExplainability with a Forecast ARN</b>
* </p>
* </p>
* <note>
* <p>You can specify a maximum of 50 time series and 500 time points.</p>
* </note>
Expand Down
98 changes: 98 additions & 0 deletions clients/client-forecast/src/commands/CreateMonitorCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// smithy-typescript generated code
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@aws-sdk/types";

import { ForecastClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ForecastClient";
import { CreateMonitorRequest, CreateMonitorResponse } from "../models/models_0";
import {
deserializeAws_json1_1CreateMonitorCommand,
serializeAws_json1_1CreateMonitorCommand,
} from "../protocols/Aws_json1_1";

export interface CreateMonitorCommandInput extends CreateMonitorRequest {}
export interface CreateMonitorCommandOutput extends CreateMonitorResponse, __MetadataBearer {}

/**
* <p>Creates a predictor monitor resource for an existing auto predictor. Predictor monitoring allows you to see how your predictor's performance changes over time.
* For more information, see <a href="https://docs.aws.amazon.com/forecast/latest/dg/predictor-monitoring.html">Predictor Monitoring</a>.
* </p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { ForecastClient, CreateMonitorCommand } from "@aws-sdk/client-forecast"; // ES Modules import
* // const { ForecastClient, CreateMonitorCommand } = require("@aws-sdk/client-forecast"); // CommonJS import
* const client = new ForecastClient(config);
* const command = new CreateMonitorCommand(input);
* const response = await client.send(command);
* ```
*
* @see {@link CreateMonitorCommandInput} for command's `input` shape.
* @see {@link CreateMonitorCommandOutput} for command's `response` shape.
* @see {@link ForecastClientResolvedConfig | config} for ForecastClient's `config` shape.
*
*/
export class CreateMonitorCommand extends $Command<
CreateMonitorCommandInput,
CreateMonitorCommandOutput,
ForecastClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

constructor(readonly input: CreateMonitorCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: ForecastClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<CreateMonitorCommandInput, CreateMonitorCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "ForecastClient";
const commandName = "CreateMonitorCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: CreateMonitorRequest.filterSensitiveLog,
outputFilterSensitiveLog: CreateMonitorResponse.filterSensitiveLog,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

private serialize(input: CreateMonitorCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_json1_1CreateMonitorCommand(input, context);
}

private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<CreateMonitorCommandOutput> {
return deserializeAws_json1_1CreateMonitorCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
11 changes: 5 additions & 6 deletions clients/client-forecast/src/commands/DeleteDatasetCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ export interface DeleteDatasetCommandInput extends DeleteDatasetRequest {}
export interface DeleteDatasetCommandOutput extends __MetadataBearer {}

/**
* <p>Deletes an Amazon Forecast dataset that was created using the <a>CreateDataset</a>
* operation. You can only delete datasets that have a status of <code>ACTIVE</code> or
* <code>CREATE_FAILED</code>. To get the status use the <a>DescribeDataset</a>
* operation.</p>
* <p>Deletes an Amazon Forecast dataset that was created using the <a href="https://docs.aws.amazon.com/forecast/latest/dg/API_CreateDataset.html">CreateDataset</a> operation. You can
* only delete datasets that have a status of <code>ACTIVE</code> or <code>CREATE_FAILED</code>.
* To get the status use the <a href="https://docs.aws.amazon.com/forecast/latest/dg/API_DescribeDataset.html">DescribeDataset</a> operation.</p>
* <note>
* <p>Forecast does not automatically update any dataset groups that contain the deleted dataset.
* In order to update the dataset group, use the
* operation, omitting the deleted dataset's ARN.</p>
* In order to update the dataset group, use the <a href="https://docs.aws.amazon.com/forecast/latest/dg/API_UpdateDatasetGroup.html">UpdateDatasetGroup</a> operation,
* omitting the deleted dataset's ARN.</p>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export interface DeleteDatasetGroupCommandInput extends DeleteDatasetGroupReques
export interface DeleteDatasetGroupCommandOutput extends __MetadataBearer {}

/**
* <p>Deletes a dataset group created using the <a>CreateDatasetGroup</a> operation.
* <p>Deletes a dataset group created using the <a href="https://docs.aws.amazon.com/forecast/latest/dg/API_CreateDatasetGroup.html">CreateDatasetGroup</a> operation.
* You can only delete dataset groups that have a status of <code>ACTIVE</code>,
* <code>CREATE_FAILED</code>, or <code>UPDATE_FAILED</code>. To get the status, use the <a>DescribeDatasetGroup</a> operation.</p>
* <code>CREATE_FAILED</code>, or <code>UPDATE_FAILED</code>. To get the status, use the <a href="https://docs.aws.amazon.com/forecast/latest/dg/API_DescribeDatasetGroup.html">DescribeDatasetGroup</a> operation.</p>
* <p>This operation deletes only the dataset group, not the datasets in the group.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
Expand Down
Loading

0 comments on commit 74fa9b8

Please sign in to comment.