MachineLearningClient.php
98 lines
| 1 | <?php |
| 2 | namespace Aws\MachineLearning; |
| 3 | |
| 4 | use Aws\AwsClient; |
| 5 | use Aws\CommandInterface; |
| 6 | use GuzzleHttp\Psr7\Uri; |
| 7 | use Psr\Http\Message\RequestInterface; |
| 8 | |
| 9 | /** |
| 10 | * Amazon Machine Learning client. |
| 11 | * |
| 12 | * @method \Aws\Result addTags(array $args = []) |
| 13 | * @method \GuzzleHttp\Promise\Promise addTagsAsync(array $args = []) |
| 14 | * @method \Aws\Result createBatchPrediction(array $args = []) |
| 15 | * @method \GuzzleHttp\Promise\Promise createBatchPredictionAsync(array $args = []) |
| 16 | * @method \Aws\Result createDataSourceFromRDS(array $args = []) |
| 17 | * @method \GuzzleHttp\Promise\Promise createDataSourceFromRDSAsync(array $args = []) |
| 18 | * @method \Aws\Result createDataSourceFromRedshift(array $args = []) |
| 19 | * @method \GuzzleHttp\Promise\Promise createDataSourceFromRedshiftAsync(array $args = []) |
| 20 | * @method \Aws\Result createDataSourceFromS3(array $args = []) |
| 21 | * @method \GuzzleHttp\Promise\Promise createDataSourceFromS3Async(array $args = []) |
| 22 | * @method \Aws\Result createEvaluation(array $args = []) |
| 23 | * @method \GuzzleHttp\Promise\Promise createEvaluationAsync(array $args = []) |
| 24 | * @method \Aws\Result createMLModel(array $args = []) |
| 25 | * @method \GuzzleHttp\Promise\Promise createMLModelAsync(array $args = []) |
| 26 | * @method \Aws\Result createRealtimeEndpoint(array $args = []) |
| 27 | * @method \GuzzleHttp\Promise\Promise createRealtimeEndpointAsync(array $args = []) |
| 28 | * @method \Aws\Result deleteBatchPrediction(array $args = []) |
| 29 | * @method \GuzzleHttp\Promise\Promise deleteBatchPredictionAsync(array $args = []) |
| 30 | * @method \Aws\Result deleteDataSource(array $args = []) |
| 31 | * @method \GuzzleHttp\Promise\Promise deleteDataSourceAsync(array $args = []) |
| 32 | * @method \Aws\Result deleteEvaluation(array $args = []) |
| 33 | * @method \GuzzleHttp\Promise\Promise deleteEvaluationAsync(array $args = []) |
| 34 | * @method \Aws\Result deleteMLModel(array $args = []) |
| 35 | * @method \GuzzleHttp\Promise\Promise deleteMLModelAsync(array $args = []) |
| 36 | * @method \Aws\Result deleteRealtimeEndpoint(array $args = []) |
| 37 | * @method \GuzzleHttp\Promise\Promise deleteRealtimeEndpointAsync(array $args = []) |
| 38 | * @method \Aws\Result deleteTags(array $args = []) |
| 39 | * @method \GuzzleHttp\Promise\Promise deleteTagsAsync(array $args = []) |
| 40 | * @method \Aws\Result describeBatchPredictions(array $args = []) |
| 41 | * @method \GuzzleHttp\Promise\Promise describeBatchPredictionsAsync(array $args = []) |
| 42 | * @method \Aws\Result describeDataSources(array $args = []) |
| 43 | * @method \GuzzleHttp\Promise\Promise describeDataSourcesAsync(array $args = []) |
| 44 | * @method \Aws\Result describeEvaluations(array $args = []) |
| 45 | * @method \GuzzleHttp\Promise\Promise describeEvaluationsAsync(array $args = []) |
| 46 | * @method \Aws\Result describeMLModels(array $args = []) |
| 47 | * @method \GuzzleHttp\Promise\Promise describeMLModelsAsync(array $args = []) |
| 48 | * @method \Aws\Result describeTags(array $args = []) |
| 49 | * @method \GuzzleHttp\Promise\Promise describeTagsAsync(array $args = []) |
| 50 | * @method \Aws\Result getBatchPrediction(array $args = []) |
| 51 | * @method \GuzzleHttp\Promise\Promise getBatchPredictionAsync(array $args = []) |
| 52 | * @method \Aws\Result getDataSource(array $args = []) |
| 53 | * @method \GuzzleHttp\Promise\Promise getDataSourceAsync(array $args = []) |
| 54 | * @method \Aws\Result getEvaluation(array $args = []) |
| 55 | * @method \GuzzleHttp\Promise\Promise getEvaluationAsync(array $args = []) |
| 56 | * @method \Aws\Result getMLModel(array $args = []) |
| 57 | * @method \GuzzleHttp\Promise\Promise getMLModelAsync(array $args = []) |
| 58 | * @method \Aws\Result predict(array $args = []) |
| 59 | * @method \GuzzleHttp\Promise\Promise predictAsync(array $args = []) |
| 60 | * @method \Aws\Result updateBatchPrediction(array $args = []) |
| 61 | * @method \GuzzleHttp\Promise\Promise updateBatchPredictionAsync(array $args = []) |
| 62 | * @method \Aws\Result updateDataSource(array $args = []) |
| 63 | * @method \GuzzleHttp\Promise\Promise updateDataSourceAsync(array $args = []) |
| 64 | * @method \Aws\Result updateEvaluation(array $args = []) |
| 65 | * @method \GuzzleHttp\Promise\Promise updateEvaluationAsync(array $args = []) |
| 66 | * @method \Aws\Result updateMLModel(array $args = []) |
| 67 | * @method \GuzzleHttp\Promise\Promise updateMLModelAsync(array $args = []) |
| 68 | */ |
| 69 | class MachineLearningClient extends AwsClient |
| 70 | { |
| 71 | public function __construct(array $config) |
| 72 | { |
| 73 | parent::__construct($config); |
| 74 | $list = $this->getHandlerList(); |
| 75 | $list->appendBuild($this->predictEndpoint(), 'ml.predict_endpoint'); |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Changes the endpoint of the Predict operation to the provided endpoint. |
| 80 | * |
| 81 | * @return callable |
| 82 | */ |
| 83 | private function predictEndpoint() |
| 84 | { |
| 85 | return static function (callable $handler) { |
| 86 | return function ( |
| 87 | CommandInterface $command, |
| 88 | RequestInterface $request = null |
| 89 | ) use ($handler) { |
| 90 | if ($command->getName() === 'Predict') { |
| 91 | $request = $request->withUri(new Uri($command['PredictEndpoint'])); |
| 92 | } |
| 93 | return $handler($command, $request); |
| 94 | }; |
| 95 | }; |
| 96 | } |
| 97 | } |
| 98 |