-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec280a8
commit ff2fd08
Showing
3 changed files
with
205 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ AWS Service Customizations | |
|
||
apigateway-customizations | ||
glacier-customizations | ||
machinelearning-customizations |
22 changes: 22 additions & 0 deletions
22
docs/source/1.0/spec/aws/customizations/machinelearning-customizations.rst
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,22 @@ | ||
====================================== | ||
Amazon Machine Learning Customizations | ||
====================================== | ||
|
||
.. contents:: Table of contents | ||
:depth: 1 | ||
:local: | ||
:backlinks: none | ||
|
||
|
||
---------------------------------------- | ||
Set host to value of ``PredictEndpoint`` | ||
---------------------------------------- | ||
|
||
The `Predict operation`_ makes use of an endpoint provided by other operations | ||
in the service. The operation expects that the request will be sent to the | ||
host specified in the ``PredictEndpoint`` parameter. An AWS client SHOULD | ||
automatically set the host for the request to the host from the | ||
``PredictEndpoint`` value. | ||
|
||
|
||
.. _Predict operation: https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_Predict.html |
182 changes: 182 additions & 0 deletions
182
smithy-aws-protocol-tests/model/awsJson1_1/services/machinelearning.smithy
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,182 @@ | ||
$version: "1.0" | ||
|
||
namespace com.amazonaws.machinelearning | ||
|
||
use aws.api#service | ||
use aws.auth#sigv4 | ||
use aws.protocols#awsJson1_1 | ||
use smithy.test#httpRequestTests | ||
|
||
@service( | ||
sdkId: "Machine Learning", | ||
arnNamespace: "machinelearning", | ||
cloudFormationName: "MachineLearning", | ||
cloudTrailEventSource: "machinelearning.amazonaws.com", | ||
endpointPrefix: "machinelearning", | ||
) | ||
@sigv4( | ||
name: "machinelearning", | ||
) | ||
@awsJson1_1 | ||
@title("Amazon Machine Learning") | ||
@xmlNamespace( | ||
uri: "http://machinelearning.amazonaws.com/doc/2014-12-12/", | ||
) | ||
service AmazonML_20141212 { | ||
version: "2014-12-12", | ||
operations: [ | ||
Predict, | ||
], | ||
} | ||
|
||
@httpRequestTests([ | ||
{ | ||
id: "MachinelearningPredictEndpoint", | ||
documentation: """ | ||
MachineLearning's api makes use of generated endpoints that the | ||
customer is then expected to use for the Predict operation. Having | ||
to alter the endpoint for a specific operation would be cumbersome, | ||
so an AWS client should be able to do it for them.""", | ||
protocol: awsJson1_1, | ||
method: "POST", | ||
uri: "/", | ||
host: "example.com", | ||
resolvedHost: "custom.example.com", | ||
body: "{\"MLModelId\": \"foo\", \"Record\": {}, \"PredictEndpoint\": \"https://custom.example.com\"}", | ||
bodyMediaType: "application/json", | ||
headers: {"Content-Type": "application/x-amz-json-1.1"}, | ||
params: { | ||
MLModelId: "foo", | ||
Record: {}, | ||
PredictEndpoint: "https://custom.example.com/", | ||
} | ||
} | ||
]) | ||
operation Predict { | ||
input: PredictInput, | ||
output: PredictOutput, | ||
errors: [ | ||
InternalServerException, | ||
InvalidInputException, | ||
LimitExceededException, | ||
PredictorNotMountedException, | ||
ResourceNotFoundException, | ||
], | ||
} | ||
|
||
@error("server") | ||
@httpError(500) | ||
structure InternalServerException { | ||
message: ErrorMessage, | ||
code: ErrorCode, | ||
} | ||
|
||
@error("client") | ||
@httpError(400) | ||
structure InvalidInputException { | ||
message: ErrorMessage, | ||
code: ErrorCode, | ||
} | ||
|
||
@error("client") | ||
@httpError(417) | ||
structure LimitExceededException { | ||
message: ErrorMessage, | ||
code: ErrorCode, | ||
} | ||
|
||
structure PredictInput { | ||
@required | ||
MLModelId: EntityId, | ||
@required | ||
Record: Record, | ||
@required | ||
PredictEndpoint: VipURLUnvalidated, | ||
} | ||
|
||
structure Prediction { | ||
predictedLabel: Label, | ||
predictedValue: floatLabel, | ||
predictedScores: ScoreValuePerLabelMap, | ||
details: DetailsMap, | ||
} | ||
|
||
@error("client") | ||
@httpError(400) | ||
structure PredictorNotMountedException { | ||
message: ErrorMessage, | ||
} | ||
|
||
structure PredictOutput { | ||
Prediction: Prediction, | ||
} | ||
|
||
@error("client") | ||
@httpError(404) | ||
structure ResourceNotFoundException { | ||
message: ErrorMessage, | ||
code: ErrorCode, | ||
} | ||
|
||
map DetailsMap { | ||
key: DetailsAttributes, | ||
value: DetailsValue, | ||
} | ||
|
||
map Record { | ||
key: VariableName, | ||
value: VariableValue, | ||
} | ||
|
||
map ScoreValuePerLabelMap { | ||
key: Label, | ||
value: ScoreValue, | ||
} | ||
|
||
@enum([ | ||
{ | ||
value: "PredictiveModelType", | ||
name: "PREDICTIVE_MODEL_TYPE", | ||
}, | ||
{ | ||
value: "Algorithm", | ||
name: "ALGORITHM", | ||
}, | ||
]) | ||
string DetailsAttributes | ||
|
||
@length( | ||
min: 1, | ||
) | ||
string DetailsValue | ||
|
||
@length( | ||
min: 1, | ||
max: 64, | ||
) | ||
@pattern("[a-zA-Z0-9_.-]+") | ||
string EntityId | ||
|
||
integer ErrorCode | ||
|
||
@length( | ||
min: 0, | ||
max: 2048, | ||
) | ||
string ErrorMessage | ||
|
||
@box | ||
float floatLabel | ||
|
||
@length( | ||
min: 1, | ||
) | ||
string Label | ||
|
||
float ScoreValue | ||
|
||
string VariableName | ||
|
||
string VariableValue | ||
|
||
string VipURLUnvalidated |