libZSservicesZSamazonka-cloudfrontZSamazonka-cloudfront
Copyright(c) 2013-2021 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone

Amazonka.CloudFront.TestFunction

Description

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

Creating a Request

data TestFunction Source #

See: newTestFunction smart constructor.

Constructors

TestFunction' 

Fields

  • stage :: Maybe FunctionStage

    The stage of the function that you are testing, either DEVELOPMENT or LIVE.

  • name :: Text

    The name of the function that you are testing.

  • ifMatch :: Text

    The current version (ETag value) of the function that you are testing, which you can get using DescribeFunction.

  • eventObject :: Sensitive Base64

    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.

Instances

Instances details
Eq TestFunction Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

Show TestFunction Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

Generic TestFunction Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

Associated Types

type Rep TestFunction :: Type -> Type #

NFData TestFunction Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

Methods

rnf :: TestFunction -> () #

Hashable TestFunction Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

AWSRequest TestFunction Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

Associated Types

type AWSResponse TestFunction #

ToHeaders TestFunction Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

ToPath TestFunction Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

ToQuery TestFunction Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

ToElement TestFunction Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

ToXML TestFunction Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

Methods

toXML :: TestFunction -> XML #

type Rep TestFunction Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

type Rep TestFunction = D1 ('MetaData "TestFunction" "Amazonka.CloudFront.TestFunction" "libZSservicesZSamazonka-cloudfrontZSamazonka-cloudfront" 'False) (C1 ('MetaCons "TestFunction'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "stage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe FunctionStage)) :*: S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "ifMatch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "eventObject") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Sensitive Base64)))))
type AWSResponse TestFunction Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

newTestFunction Source #

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.

Constructors

TestFunctionResponse' 

Fields

Instances

Instances details
Eq TestFunctionResponse Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

Read TestFunctionResponse Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

Show TestFunctionResponse Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

Generic TestFunctionResponse Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

Associated Types

type Rep TestFunctionResponse :: Type -> Type #

NFData TestFunctionResponse Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

Methods

rnf :: TestFunctionResponse -> () #

type Rep TestFunctionResponse Source # 
Instance details

Defined in Amazonka.CloudFront.TestFunction

type Rep TestFunctionResponse = D1 ('MetaData "TestFunctionResponse" "Amazonka.CloudFront.TestFunction" "libZSservicesZSamazonka-cloudfrontZSamazonka-cloudfront" 'False) (C1 ('MetaCons "TestFunctionResponse'" 'PrefixI 'True) (S1 ('MetaSel ('Just "testResult") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe TestResult)) :*: S1 ('MetaSel ('Just "httpStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))

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.