-
Notifications
You must be signed in to change notification settings - Fork 559
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(client-personalize): Adding StartRecommender and StopRecommender…
… APIs for Personalize.
- Loading branch information
awstools
committed
Apr 19, 2022
1 parent
17ba1fe
commit 67d79bf
Showing
9 changed files
with
638 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
clients/client-personalize/src/commands/StartRecommenderCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
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 { StartRecommenderRequest, StartRecommenderResponse } from "../models/models_0"; | ||
import { PersonalizeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../PersonalizeClient"; | ||
import { | ||
deserializeAws_json1_1StartRecommenderCommand, | ||
serializeAws_json1_1StartRecommenderCommand, | ||
} from "../protocols/Aws_json1_1"; | ||
|
||
export interface StartRecommenderCommandInput extends StartRecommenderRequest {} | ||
export interface StartRecommenderCommandOutput extends StartRecommenderResponse, __MetadataBearer {} | ||
|
||
/** | ||
* <p>Starts a recommender that is INACTIVE. Starting a recommender does not | ||
* create any new models, but resumes billing and automatic retraining for the recommender.</p> | ||
* @example | ||
* Use a bare-bones client and the command you need to make an API call. | ||
* ```javascript | ||
* import { PersonalizeClient, StartRecommenderCommand } from "@aws-sdk/client-personalize"; // ES Modules import | ||
* // const { PersonalizeClient, StartRecommenderCommand } = require("@aws-sdk/client-personalize"); // CommonJS import | ||
* const client = new PersonalizeClient(config); | ||
* const command = new StartRecommenderCommand(input); | ||
* const response = await client.send(command); | ||
* ``` | ||
* | ||
* @see {@link StartRecommenderCommandInput} for command's `input` shape. | ||
* @see {@link StartRecommenderCommandOutput} for command's `response` shape. | ||
* @see {@link PersonalizeClientResolvedConfig | config} for PersonalizeClient's `config` shape. | ||
* | ||
*/ | ||
export class StartRecommenderCommand extends $Command< | ||
StartRecommenderCommandInput, | ||
StartRecommenderCommandOutput, | ||
PersonalizeClientResolvedConfig | ||
> { | ||
// Start section: command_properties | ||
// End section: command_properties | ||
|
||
constructor(readonly input: StartRecommenderCommandInput) { | ||
// Start section: command_constructor | ||
super(); | ||
// End section: command_constructor | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
resolveMiddleware( | ||
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, | ||
configuration: PersonalizeClientResolvedConfig, | ||
options?: __HttpHandlerOptions | ||
): Handler<StartRecommenderCommandInput, StartRecommenderCommandOutput> { | ||
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); | ||
|
||
const stack = clientStack.concat(this.middlewareStack); | ||
|
||
const { logger } = configuration; | ||
const clientName = "PersonalizeClient"; | ||
const commandName = "StartRecommenderCommand"; | ||
const handlerExecutionContext: HandlerExecutionContext = { | ||
logger, | ||
clientName, | ||
commandName, | ||
inputFilterSensitiveLog: StartRecommenderRequest.filterSensitiveLog, | ||
outputFilterSensitiveLog: StartRecommenderResponse.filterSensitiveLog, | ||
}; | ||
const { requestHandler } = configuration; | ||
return stack.resolve( | ||
(request: FinalizeHandlerArguments<any>) => | ||
requestHandler.handle(request.request as __HttpRequest, options || {}), | ||
handlerExecutionContext | ||
); | ||
} | ||
|
||
private serialize(input: StartRecommenderCommandInput, context: __SerdeContext): Promise<__HttpRequest> { | ||
return serializeAws_json1_1StartRecommenderCommand(input, context); | ||
} | ||
|
||
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<StartRecommenderCommandOutput> { | ||
return deserializeAws_json1_1StartRecommenderCommand(output, context); | ||
} | ||
|
||
// Start section: command_body_extra | ||
// End section: command_body_extra | ||
} |
95 changes: 95 additions & 0 deletions
95
clients/client-personalize/src/commands/StopRecommenderCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
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 { StopRecommenderRequest, StopRecommenderResponse } from "../models/models_0"; | ||
import { PersonalizeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../PersonalizeClient"; | ||
import { | ||
deserializeAws_json1_1StopRecommenderCommand, | ||
serializeAws_json1_1StopRecommenderCommand, | ||
} from "../protocols/Aws_json1_1"; | ||
|
||
export interface StopRecommenderCommandInput extends StopRecommenderRequest {} | ||
export interface StopRecommenderCommandOutput extends StopRecommenderResponse, __MetadataBearer {} | ||
|
||
/** | ||
* <p>Stops a recommender that is ACTIVE. Stopping a recommender halts billing and automatic retraining for the recommender.</p> | ||
* @example | ||
* Use a bare-bones client and the command you need to make an API call. | ||
* ```javascript | ||
* import { PersonalizeClient, StopRecommenderCommand } from "@aws-sdk/client-personalize"; // ES Modules import | ||
* // const { PersonalizeClient, StopRecommenderCommand } = require("@aws-sdk/client-personalize"); // CommonJS import | ||
* const client = new PersonalizeClient(config); | ||
* const command = new StopRecommenderCommand(input); | ||
* const response = await client.send(command); | ||
* ``` | ||
* | ||
* @see {@link StopRecommenderCommandInput} for command's `input` shape. | ||
* @see {@link StopRecommenderCommandOutput} for command's `response` shape. | ||
* @see {@link PersonalizeClientResolvedConfig | config} for PersonalizeClient's `config` shape. | ||
* | ||
*/ | ||
export class StopRecommenderCommand extends $Command< | ||
StopRecommenderCommandInput, | ||
StopRecommenderCommandOutput, | ||
PersonalizeClientResolvedConfig | ||
> { | ||
// Start section: command_properties | ||
// End section: command_properties | ||
|
||
constructor(readonly input: StopRecommenderCommandInput) { | ||
// Start section: command_constructor | ||
super(); | ||
// End section: command_constructor | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
resolveMiddleware( | ||
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>, | ||
configuration: PersonalizeClientResolvedConfig, | ||
options?: __HttpHandlerOptions | ||
): Handler<StopRecommenderCommandInput, StopRecommenderCommandOutput> { | ||
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); | ||
|
||
const stack = clientStack.concat(this.middlewareStack); | ||
|
||
const { logger } = configuration; | ||
const clientName = "PersonalizeClient"; | ||
const commandName = "StopRecommenderCommand"; | ||
const handlerExecutionContext: HandlerExecutionContext = { | ||
logger, | ||
clientName, | ||
commandName, | ||
inputFilterSensitiveLog: StopRecommenderRequest.filterSensitiveLog, | ||
outputFilterSensitiveLog: StopRecommenderResponse.filterSensitiveLog, | ||
}; | ||
const { requestHandler } = configuration; | ||
return stack.resolve( | ||
(request: FinalizeHandlerArguments<any>) => | ||
requestHandler.handle(request.request as __HttpRequest, options || {}), | ||
handlerExecutionContext | ||
); | ||
} | ||
|
||
private serialize(input: StopRecommenderCommandInput, context: __SerdeContext): Promise<__HttpRequest> { | ||
return serializeAws_json1_1StopRecommenderCommand(input, context); | ||
} | ||
|
||
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<StopRecommenderCommandOutput> { | ||
return deserializeAws_json1_1StopRecommenderCommand(output, context); | ||
} | ||
|
||
// Start section: command_body_extra | ||
// End section: command_body_extra | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.