Copyright | (c) 2013-2021 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay <brendan.g.hay+amazonka@gmail.com> |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Tests a CloudFront function.
To test a function, you provide an event object that represents an HTTP request or response that your CloudFront distribution could receive in production. CloudFront runs the function, passing it the event object that you provided, and returns the function’s result (the modified event object) in the response. The response also contains function logs and error messages, if any exist. For more information about testing functions, see Testing functions in the Amazon CloudFront Developer Guide.
To test a function, you provide the function’s name and version (ETag
value) along with the event object. To get the function’s name and
version, you can use ListFunctions
and DescribeFunction
.
Synopsis
- data TestFunction = TestFunction' {
- stage :: Maybe FunctionStage
- name :: Text
- ifMatch :: Text
- eventObject :: Sensitive Base64
- newTestFunction :: Text -> Text -> ByteString -> TestFunction
- testFunction_stage :: Lens' TestFunction (Maybe FunctionStage)
- testFunction_name :: Lens' TestFunction Text
- testFunction_ifMatch :: Lens' TestFunction Text
- testFunction_eventObject :: Lens' TestFunction ByteString
- data TestFunctionResponse = TestFunctionResponse' {}
- newTestFunctionResponse :: Int -> TestFunctionResponse
- testFunctionResponse_testResult :: Lens' TestFunctionResponse (Maybe TestResult)
- testFunctionResponse_httpStatus :: Lens' TestFunctionResponse Int
Creating a Request
data TestFunction Source #
See: newTestFunction
smart constructor.
TestFunction' | |
|
Instances
:: Text | |
-> Text | |
-> ByteString | |
-> TestFunction |
Create a value of TestFunction
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
$sel:stage:TestFunction'
, testFunction_stage
- The stage of the function that you are testing, either DEVELOPMENT
or
LIVE
.
$sel:name:TestFunction'
, testFunction_name
- The name of the function that you are testing.
$sel:ifMatch:TestFunction'
, testFunction_ifMatch
- The current version (ETag
value) of the function that you are testing,
which you can get using DescribeFunction
.
$sel:eventObject:TestFunction'
, testFunction_eventObject
- The event object to test the function with. For more information about
the structure of the event object, see
Testing functions
in the Amazon CloudFront Developer Guide.--
-- Note: This Lens
automatically encodes and decodes Base64 data.
-- The underlying isomorphism will encode to Base64 representation during
-- serialisation, and decode from Base64 representation during deserialisation.
-- This Lens
accepts and returns only raw unencoded data.
Request Lenses
testFunction_stage :: Lens' TestFunction (Maybe FunctionStage) Source #
The stage of the function that you are testing, either DEVELOPMENT
or
LIVE
.
testFunction_name :: Lens' TestFunction Text Source #
The name of the function that you are testing.
testFunction_ifMatch :: Lens' TestFunction Text Source #
The current version (ETag
value) of the function that you are testing,
which you can get using DescribeFunction
.
testFunction_eventObject :: Lens' TestFunction ByteString Source #
The event object to test the function with. For more information about
the structure of the event object, see
Testing functions
in the Amazon CloudFront Developer Guide.--
-- Note: This Lens
automatically encodes and decodes Base64 data.
-- The underlying isomorphism will encode to Base64 representation during
-- serialisation, and decode from Base64 representation during deserialisation.
-- This Lens
accepts and returns only raw unencoded data.
Destructuring the Response
data TestFunctionResponse Source #
See: newTestFunctionResponse
smart constructor.
TestFunctionResponse' | |
|
Instances
newTestFunctionResponse Source #
Create a value of TestFunctionResponse
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
$sel:testResult:TestFunctionResponse'
, testFunctionResponse_testResult
- An object that represents the result of running the function with the
provided event object.
$sel:httpStatus:TestFunctionResponse'
, testFunctionResponse_httpStatus
- The response's http status code.
Response Lenses
testFunctionResponse_testResult :: Lens' TestFunctionResponse (Maybe TestResult) Source #
An object that represents the result of running the function with the provided event object.
testFunctionResponse_httpStatus :: Lens' TestFunctionResponse Int Source #
The response's http status code.