{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.WAFV2.Types.FieldToMatch
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.WAFV2.Types.FieldToMatch where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.WAFV2.Types.AllQueryArguments
import Amazonka.WAFV2.Types.Body
import Amazonka.WAFV2.Types.Cookies
import Amazonka.WAFV2.Types.Headers
import Amazonka.WAFV2.Types.JsonBody
import Amazonka.WAFV2.Types.Method
import Amazonka.WAFV2.Types.QueryString
import Amazonka.WAFV2.Types.SingleHeader
import Amazonka.WAFV2.Types.SingleQueryArgument
import Amazonka.WAFV2.Types.UriPath

-- | The part of the web request that you want WAF to inspect. Include the
-- single @FieldToMatch@ type that you want to inspect, with additional
-- specifications as needed, according to the type. You specify a single
-- request component in @FieldToMatch@ for each rule statement that
-- requires it. To inspect more than one component of the web request,
-- create a separate rule statement for each component.
--
-- Example JSON for a @QueryString@ field to match:
--
-- @ \"FieldToMatch\": { \"QueryString\": {} }@
--
-- Example JSON for a @Method@ field to match specification:
--
-- @ \"FieldToMatch\": { \"Method\": { \"Name\": \"DELETE\" } }@
--
-- /See:/ 'newFieldToMatch' smart constructor.
data FieldToMatch = FieldToMatch'
  { -- | Inspect all query arguments.
    FieldToMatch -> Maybe AllQueryArguments
allQueryArguments :: Prelude.Maybe AllQueryArguments,
    -- | Inspect the request body as plain text. The request body immediately
    -- follows the request headers. This is the part of a request that contains
    -- any additional data that you want to send to your web server as the HTTP
    -- request body, such as data from a form.
    --
    -- Only the first 8 KB (8192 bytes) of the request body are forwarded to
    -- WAF for inspection by the underlying host service. For information about
    -- how to handle oversized request bodies, see the @Body@ object
    -- configuration.
    FieldToMatch -> Maybe Body
body :: Prelude.Maybe Body,
    -- | Inspect the request cookies. You must configure scope and pattern
    -- matching filters in the @Cookies@ object, to define the set of cookies
    -- and the parts of the cookies that WAF inspects.
    --
    -- Only the first 8 KB (8192 bytes) of a request\'s cookies and only the
    -- first 200 cookies are forwarded to WAF for inspection by the underlying
    -- host service. You must configure how to handle any oversize cookie
    -- content in the @Cookies@ object. WAF applies the pattern matching
    -- filters to the cookies that it receives from the underlying host
    -- service.
    FieldToMatch -> Maybe Cookies
cookies :: Prelude.Maybe Cookies,
    -- | Inspect the request headers. You must configure scope and pattern
    -- matching filters in the @Headers@ object, to define the set of headers
    -- to and the parts of the headers that WAF inspects.
    --
    -- Only the first 8 KB (8192 bytes) of a request\'s headers and only the
    -- first 200 headers are forwarded to WAF for inspection by the underlying
    -- host service. You must configure how to handle any oversize header
    -- content in the @Headers@ object. WAF applies the pattern matching
    -- filters to the headers that it receives from the underlying host
    -- service.
    FieldToMatch -> Maybe Headers
headers :: Prelude.Maybe Headers,
    -- | Inspect the request body as JSON. The request body immediately follows
    -- the request headers. This is the part of a request that contains any
    -- additional data that you want to send to your web server as the HTTP
    -- request body, such as data from a form.
    --
    -- Only the first 8 KB (8192 bytes) of the request body are forwarded to
    -- WAF for inspection by the underlying host service. For information about
    -- how to handle oversized request bodies, see the @JsonBody@ object
    -- configuration.
    FieldToMatch -> Maybe JsonBody
jsonBody :: Prelude.Maybe JsonBody,
    -- | Inspect the HTTP method. The method indicates the type of operation that
    -- the request is asking the origin to perform.
    FieldToMatch -> Maybe Method
method :: Prelude.Maybe Method,
    -- | Inspect the query string. This is the part of a URL that appears after a
    -- @?@ character, if any.
    FieldToMatch -> Maybe QueryString
queryString :: Prelude.Maybe QueryString,
    -- | Inspect a single header. Provide the name of the header to inspect, for
    -- example, @User-Agent@ or @Referer@. This setting isn\'t case sensitive.
    --
    -- Example JSON: @\"SingleHeader\": { \"Name\": \"haystack\" }@
    --
    -- Alternately, you can filter and inspect all headers with the @Headers@
    -- @FieldToMatch@ setting.
    FieldToMatch -> Maybe SingleHeader
singleHeader :: Prelude.Maybe SingleHeader,
    -- | Inspect a single query argument. Provide the name of the query argument
    -- to inspect, such as /UserName/ or /SalesRegion/. The name can be up to
    -- 30 characters long and isn\'t case sensitive.
    --
    -- Example JSON: @\"SingleQueryArgument\": { \"Name\": \"myArgument\" }@
    FieldToMatch -> Maybe SingleQueryArgument
singleQueryArgument :: Prelude.Maybe SingleQueryArgument,
    -- | Inspect the request URI path. This is the part of the web request that
    -- identifies a resource, for example, @\/images\/daily-ad.jpg@.
    FieldToMatch -> Maybe UriPath
uriPath :: Prelude.Maybe UriPath
  }
  deriving (FieldToMatch -> FieldToMatch -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FieldToMatch -> FieldToMatch -> Bool
$c/= :: FieldToMatch -> FieldToMatch -> Bool
== :: FieldToMatch -> FieldToMatch -> Bool
$c== :: FieldToMatch -> FieldToMatch -> Bool
Prelude.Eq, ReadPrec [FieldToMatch]
ReadPrec FieldToMatch
Int -> ReadS FieldToMatch
ReadS [FieldToMatch]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FieldToMatch]
$creadListPrec :: ReadPrec [FieldToMatch]
readPrec :: ReadPrec FieldToMatch
$creadPrec :: ReadPrec FieldToMatch
readList :: ReadS [FieldToMatch]
$creadList :: ReadS [FieldToMatch]
readsPrec :: Int -> ReadS FieldToMatch
$creadsPrec :: Int -> ReadS FieldToMatch
Prelude.Read, Int -> FieldToMatch -> ShowS
[FieldToMatch] -> ShowS
FieldToMatch -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FieldToMatch] -> ShowS
$cshowList :: [FieldToMatch] -> ShowS
show :: FieldToMatch -> String
$cshow :: FieldToMatch -> String
showsPrec :: Int -> FieldToMatch -> ShowS
$cshowsPrec :: Int -> FieldToMatch -> ShowS
Prelude.Show, forall x. Rep FieldToMatch x -> FieldToMatch
forall x. FieldToMatch -> Rep FieldToMatch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FieldToMatch x -> FieldToMatch
$cfrom :: forall x. FieldToMatch -> Rep FieldToMatch x
Prelude.Generic)

-- |
-- Create a value of 'FieldToMatch' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'allQueryArguments', 'fieldToMatch_allQueryArguments' - Inspect all query arguments.
--
-- 'body', 'fieldToMatch_body' - Inspect the request body as plain text. The request body immediately
-- follows the request headers. This is the part of a request that contains
-- any additional data that you want to send to your web server as the HTTP
-- request body, such as data from a form.
--
-- Only the first 8 KB (8192 bytes) of the request body are forwarded to
-- WAF for inspection by the underlying host service. For information about
-- how to handle oversized request bodies, see the @Body@ object
-- configuration.
--
-- 'cookies', 'fieldToMatch_cookies' - Inspect the request cookies. You must configure scope and pattern
-- matching filters in the @Cookies@ object, to define the set of cookies
-- and the parts of the cookies that WAF inspects.
--
-- Only the first 8 KB (8192 bytes) of a request\'s cookies and only the
-- first 200 cookies are forwarded to WAF for inspection by the underlying
-- host service. You must configure how to handle any oversize cookie
-- content in the @Cookies@ object. WAF applies the pattern matching
-- filters to the cookies that it receives from the underlying host
-- service.
--
-- 'headers', 'fieldToMatch_headers' - Inspect the request headers. You must configure scope and pattern
-- matching filters in the @Headers@ object, to define the set of headers
-- to and the parts of the headers that WAF inspects.
--
-- Only the first 8 KB (8192 bytes) of a request\'s headers and only the
-- first 200 headers are forwarded to WAF for inspection by the underlying
-- host service. You must configure how to handle any oversize header
-- content in the @Headers@ object. WAF applies the pattern matching
-- filters to the headers that it receives from the underlying host
-- service.
--
-- 'jsonBody', 'fieldToMatch_jsonBody' - Inspect the request body as JSON. The request body immediately follows
-- the request headers. This is the part of a request that contains any
-- additional data that you want to send to your web server as the HTTP
-- request body, such as data from a form.
--
-- Only the first 8 KB (8192 bytes) of the request body are forwarded to
-- WAF for inspection by the underlying host service. For information about
-- how to handle oversized request bodies, see the @JsonBody@ object
-- configuration.
--
-- 'method', 'fieldToMatch_method' - Inspect the HTTP method. The method indicates the type of operation that
-- the request is asking the origin to perform.
--
-- 'queryString', 'fieldToMatch_queryString' - Inspect the query string. This is the part of a URL that appears after a
-- @?@ character, if any.
--
-- 'singleHeader', 'fieldToMatch_singleHeader' - Inspect a single header. Provide the name of the header to inspect, for
-- example, @User-Agent@ or @Referer@. This setting isn\'t case sensitive.
--
-- Example JSON: @\"SingleHeader\": { \"Name\": \"haystack\" }@
--
-- Alternately, you can filter and inspect all headers with the @Headers@
-- @FieldToMatch@ setting.
--
-- 'singleQueryArgument', 'fieldToMatch_singleQueryArgument' - Inspect a single query argument. Provide the name of the query argument
-- to inspect, such as /UserName/ or /SalesRegion/. The name can be up to
-- 30 characters long and isn\'t case sensitive.
--
-- Example JSON: @\"SingleQueryArgument\": { \"Name\": \"myArgument\" }@
--
-- 'uriPath', 'fieldToMatch_uriPath' - Inspect the request URI path. This is the part of the web request that
-- identifies a resource, for example, @\/images\/daily-ad.jpg@.
newFieldToMatch ::
  FieldToMatch
newFieldToMatch :: FieldToMatch
newFieldToMatch =
  FieldToMatch'
    { $sel:allQueryArguments:FieldToMatch' :: Maybe AllQueryArguments
allQueryArguments = forall a. Maybe a
Prelude.Nothing,
      $sel:body:FieldToMatch' :: Maybe Body
body = forall a. Maybe a
Prelude.Nothing,
      $sel:cookies:FieldToMatch' :: Maybe Cookies
cookies = forall a. Maybe a
Prelude.Nothing,
      $sel:headers:FieldToMatch' :: Maybe Headers
headers = forall a. Maybe a
Prelude.Nothing,
      $sel:jsonBody:FieldToMatch' :: Maybe JsonBody
jsonBody = forall a. Maybe a
Prelude.Nothing,
      $sel:method:FieldToMatch' :: Maybe Method
method = forall a. Maybe a
Prelude.Nothing,
      $sel:queryString:FieldToMatch' :: Maybe QueryString
queryString = forall a. Maybe a
Prelude.Nothing,
      $sel:singleHeader:FieldToMatch' :: Maybe SingleHeader
singleHeader = forall a. Maybe a
Prelude.Nothing,
      $sel:singleQueryArgument:FieldToMatch' :: Maybe SingleQueryArgument
singleQueryArgument = forall a. Maybe a
Prelude.Nothing,
      $sel:uriPath:FieldToMatch' :: Maybe UriPath
uriPath = forall a. Maybe a
Prelude.Nothing
    }

-- | Inspect all query arguments.
fieldToMatch_allQueryArguments :: Lens.Lens' FieldToMatch (Prelude.Maybe AllQueryArguments)
fieldToMatch_allQueryArguments :: Lens' FieldToMatch (Maybe AllQueryArguments)
fieldToMatch_allQueryArguments = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldToMatch' {Maybe AllQueryArguments
allQueryArguments :: Maybe AllQueryArguments
$sel:allQueryArguments:FieldToMatch' :: FieldToMatch -> Maybe AllQueryArguments
allQueryArguments} -> Maybe AllQueryArguments
allQueryArguments) (\s :: FieldToMatch
s@FieldToMatch' {} Maybe AllQueryArguments
a -> FieldToMatch
s {$sel:allQueryArguments:FieldToMatch' :: Maybe AllQueryArguments
allQueryArguments = Maybe AllQueryArguments
a} :: FieldToMatch)

-- | Inspect the request body as plain text. The request body immediately
-- follows the request headers. This is the part of a request that contains
-- any additional data that you want to send to your web server as the HTTP
-- request body, such as data from a form.
--
-- Only the first 8 KB (8192 bytes) of the request body are forwarded to
-- WAF for inspection by the underlying host service. For information about
-- how to handle oversized request bodies, see the @Body@ object
-- configuration.
fieldToMatch_body :: Lens.Lens' FieldToMatch (Prelude.Maybe Body)
fieldToMatch_body :: Lens' FieldToMatch (Maybe Body)
fieldToMatch_body = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldToMatch' {Maybe Body
body :: Maybe Body
$sel:body:FieldToMatch' :: FieldToMatch -> Maybe Body
body} -> Maybe Body
body) (\s :: FieldToMatch
s@FieldToMatch' {} Maybe Body
a -> FieldToMatch
s {$sel:body:FieldToMatch' :: Maybe Body
body = Maybe Body
a} :: FieldToMatch)

-- | Inspect the request cookies. You must configure scope and pattern
-- matching filters in the @Cookies@ object, to define the set of cookies
-- and the parts of the cookies that WAF inspects.
--
-- Only the first 8 KB (8192 bytes) of a request\'s cookies and only the
-- first 200 cookies are forwarded to WAF for inspection by the underlying
-- host service. You must configure how to handle any oversize cookie
-- content in the @Cookies@ object. WAF applies the pattern matching
-- filters to the cookies that it receives from the underlying host
-- service.
fieldToMatch_cookies :: Lens.Lens' FieldToMatch (Prelude.Maybe Cookies)
fieldToMatch_cookies :: Lens' FieldToMatch (Maybe Cookies)
fieldToMatch_cookies = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldToMatch' {Maybe Cookies
cookies :: Maybe Cookies
$sel:cookies:FieldToMatch' :: FieldToMatch -> Maybe Cookies
cookies} -> Maybe Cookies
cookies) (\s :: FieldToMatch
s@FieldToMatch' {} Maybe Cookies
a -> FieldToMatch
s {$sel:cookies:FieldToMatch' :: Maybe Cookies
cookies = Maybe Cookies
a} :: FieldToMatch)

-- | Inspect the request headers. You must configure scope and pattern
-- matching filters in the @Headers@ object, to define the set of headers
-- to and the parts of the headers that WAF inspects.
--
-- Only the first 8 KB (8192 bytes) of a request\'s headers and only the
-- first 200 headers are forwarded to WAF for inspection by the underlying
-- host service. You must configure how to handle any oversize header
-- content in the @Headers@ object. WAF applies the pattern matching
-- filters to the headers that it receives from the underlying host
-- service.
fieldToMatch_headers :: Lens.Lens' FieldToMatch (Prelude.Maybe Headers)
fieldToMatch_headers :: Lens' FieldToMatch (Maybe Headers)
fieldToMatch_headers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldToMatch' {Maybe Headers
headers :: Maybe Headers
$sel:headers:FieldToMatch' :: FieldToMatch -> Maybe Headers
headers} -> Maybe Headers
headers) (\s :: FieldToMatch
s@FieldToMatch' {} Maybe Headers
a -> FieldToMatch
s {$sel:headers:FieldToMatch' :: Maybe Headers
headers = Maybe Headers
a} :: FieldToMatch)

-- | Inspect the request body as JSON. The request body immediately follows
-- the request headers. This is the part of a request that contains any
-- additional data that you want to send to your web server as the HTTP
-- request body, such as data from a form.
--
-- Only the first 8 KB (8192 bytes) of the request body are forwarded to
-- WAF for inspection by the underlying host service. For information about
-- how to handle oversized request bodies, see the @JsonBody@ object
-- configuration.
fieldToMatch_jsonBody :: Lens.Lens' FieldToMatch (Prelude.Maybe JsonBody)
fieldToMatch_jsonBody :: Lens' FieldToMatch (Maybe JsonBody)
fieldToMatch_jsonBody = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldToMatch' {Maybe JsonBody
jsonBody :: Maybe JsonBody
$sel:jsonBody:FieldToMatch' :: FieldToMatch -> Maybe JsonBody
jsonBody} -> Maybe JsonBody
jsonBody) (\s :: FieldToMatch
s@FieldToMatch' {} Maybe JsonBody
a -> FieldToMatch
s {$sel:jsonBody:FieldToMatch' :: Maybe JsonBody
jsonBody = Maybe JsonBody
a} :: FieldToMatch)

-- | Inspect the HTTP method. The method indicates the type of operation that
-- the request is asking the origin to perform.
fieldToMatch_method :: Lens.Lens' FieldToMatch (Prelude.Maybe Method)
fieldToMatch_method :: Lens' FieldToMatch (Maybe Method)
fieldToMatch_method = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldToMatch' {Maybe Method
method :: Maybe Method
$sel:method:FieldToMatch' :: FieldToMatch -> Maybe Method
method} -> Maybe Method
method) (\s :: FieldToMatch
s@FieldToMatch' {} Maybe Method
a -> FieldToMatch
s {$sel:method:FieldToMatch' :: Maybe Method
method = Maybe Method
a} :: FieldToMatch)

-- | Inspect the query string. This is the part of a URL that appears after a
-- @?@ character, if any.
fieldToMatch_queryString :: Lens.Lens' FieldToMatch (Prelude.Maybe QueryString)
fieldToMatch_queryString :: Lens' FieldToMatch (Maybe QueryString)
fieldToMatch_queryString = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldToMatch' {Maybe QueryString
queryString :: Maybe QueryString
$sel:queryString:FieldToMatch' :: FieldToMatch -> Maybe QueryString
queryString} -> Maybe QueryString
queryString) (\s :: FieldToMatch
s@FieldToMatch' {} Maybe QueryString
a -> FieldToMatch
s {$sel:queryString:FieldToMatch' :: Maybe QueryString
queryString = Maybe QueryString
a} :: FieldToMatch)

-- | Inspect a single header. Provide the name of the header to inspect, for
-- example, @User-Agent@ or @Referer@. This setting isn\'t case sensitive.
--
-- Example JSON: @\"SingleHeader\": { \"Name\": \"haystack\" }@
--
-- Alternately, you can filter and inspect all headers with the @Headers@
-- @FieldToMatch@ setting.
fieldToMatch_singleHeader :: Lens.Lens' FieldToMatch (Prelude.Maybe SingleHeader)
fieldToMatch_singleHeader :: Lens' FieldToMatch (Maybe SingleHeader)
fieldToMatch_singleHeader = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldToMatch' {Maybe SingleHeader
singleHeader :: Maybe SingleHeader
$sel:singleHeader:FieldToMatch' :: FieldToMatch -> Maybe SingleHeader
singleHeader} -> Maybe SingleHeader
singleHeader) (\s :: FieldToMatch
s@FieldToMatch' {} Maybe SingleHeader
a -> FieldToMatch
s {$sel:singleHeader:FieldToMatch' :: Maybe SingleHeader
singleHeader = Maybe SingleHeader
a} :: FieldToMatch)

-- | Inspect a single query argument. Provide the name of the query argument
-- to inspect, such as /UserName/ or /SalesRegion/. The name can be up to
-- 30 characters long and isn\'t case sensitive.
--
-- Example JSON: @\"SingleQueryArgument\": { \"Name\": \"myArgument\" }@
fieldToMatch_singleQueryArgument :: Lens.Lens' FieldToMatch (Prelude.Maybe SingleQueryArgument)
fieldToMatch_singleQueryArgument :: Lens' FieldToMatch (Maybe SingleQueryArgument)
fieldToMatch_singleQueryArgument = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldToMatch' {Maybe SingleQueryArgument
singleQueryArgument :: Maybe SingleQueryArgument
$sel:singleQueryArgument:FieldToMatch' :: FieldToMatch -> Maybe SingleQueryArgument
singleQueryArgument} -> Maybe SingleQueryArgument
singleQueryArgument) (\s :: FieldToMatch
s@FieldToMatch' {} Maybe SingleQueryArgument
a -> FieldToMatch
s {$sel:singleQueryArgument:FieldToMatch' :: Maybe SingleQueryArgument
singleQueryArgument = Maybe SingleQueryArgument
a} :: FieldToMatch)

-- | Inspect the request URI path. This is the part of the web request that
-- identifies a resource, for example, @\/images\/daily-ad.jpg@.
fieldToMatch_uriPath :: Lens.Lens' FieldToMatch (Prelude.Maybe UriPath)
fieldToMatch_uriPath :: Lens' FieldToMatch (Maybe UriPath)
fieldToMatch_uriPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldToMatch' {Maybe UriPath
uriPath :: Maybe UriPath
$sel:uriPath:FieldToMatch' :: FieldToMatch -> Maybe UriPath
uriPath} -> Maybe UriPath
uriPath) (\s :: FieldToMatch
s@FieldToMatch' {} Maybe UriPath
a -> FieldToMatch
s {$sel:uriPath:FieldToMatch' :: Maybe UriPath
uriPath = Maybe UriPath
a} :: FieldToMatch)

instance Data.FromJSON FieldToMatch where
  parseJSON :: Value -> Parser FieldToMatch
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FieldToMatch"
      ( \Object
x ->
          Maybe AllQueryArguments
-> Maybe Body
-> Maybe Cookies
-> Maybe Headers
-> Maybe JsonBody
-> Maybe Method
-> Maybe QueryString
-> Maybe SingleHeader
-> Maybe SingleQueryArgument
-> Maybe UriPath
-> FieldToMatch
FieldToMatch'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AllQueryArguments")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Body")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Cookies")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Headers")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"JsonBody")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Method")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"QueryString")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SingleHeader")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SingleQueryArgument")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"UriPath")
      )

instance Prelude.Hashable FieldToMatch where
  hashWithSalt :: Int -> FieldToMatch -> Int
hashWithSalt Int
_salt FieldToMatch' {Maybe AllQueryArguments
Maybe Method
Maybe JsonBody
Maybe Headers
Maybe Cookies
Maybe Body
Maybe QueryString
Maybe SingleHeader
Maybe SingleQueryArgument
Maybe UriPath
uriPath :: Maybe UriPath
singleQueryArgument :: Maybe SingleQueryArgument
singleHeader :: Maybe SingleHeader
queryString :: Maybe QueryString
method :: Maybe Method
jsonBody :: Maybe JsonBody
headers :: Maybe Headers
cookies :: Maybe Cookies
body :: Maybe Body
allQueryArguments :: Maybe AllQueryArguments
$sel:uriPath:FieldToMatch' :: FieldToMatch -> Maybe UriPath
$sel:singleQueryArgument:FieldToMatch' :: FieldToMatch -> Maybe SingleQueryArgument
$sel:singleHeader:FieldToMatch' :: FieldToMatch -> Maybe SingleHeader
$sel:queryString:FieldToMatch' :: FieldToMatch -> Maybe QueryString
$sel:method:FieldToMatch' :: FieldToMatch -> Maybe Method
$sel:jsonBody:FieldToMatch' :: FieldToMatch -> Maybe JsonBody
$sel:headers:FieldToMatch' :: FieldToMatch -> Maybe Headers
$sel:cookies:FieldToMatch' :: FieldToMatch -> Maybe Cookies
$sel:body:FieldToMatch' :: FieldToMatch -> Maybe Body
$sel:allQueryArguments:FieldToMatch' :: FieldToMatch -> Maybe AllQueryArguments
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AllQueryArguments
allQueryArguments
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Body
body
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Cookies
cookies
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Headers
headers
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe JsonBody
jsonBody
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Method
method
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe QueryString
queryString
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SingleHeader
singleHeader
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SingleQueryArgument
singleQueryArgument
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UriPath
uriPath

instance Prelude.NFData FieldToMatch where
  rnf :: FieldToMatch -> ()
rnf FieldToMatch' {Maybe AllQueryArguments
Maybe Method
Maybe JsonBody
Maybe Headers
Maybe Cookies
Maybe Body
Maybe QueryString
Maybe SingleHeader
Maybe SingleQueryArgument
Maybe UriPath
uriPath :: Maybe UriPath
singleQueryArgument :: Maybe SingleQueryArgument
singleHeader :: Maybe SingleHeader
queryString :: Maybe QueryString
method :: Maybe Method
jsonBody :: Maybe JsonBody
headers :: Maybe Headers
cookies :: Maybe Cookies
body :: Maybe Body
allQueryArguments :: Maybe AllQueryArguments
$sel:uriPath:FieldToMatch' :: FieldToMatch -> Maybe UriPath
$sel:singleQueryArgument:FieldToMatch' :: FieldToMatch -> Maybe SingleQueryArgument
$sel:singleHeader:FieldToMatch' :: FieldToMatch -> Maybe SingleHeader
$sel:queryString:FieldToMatch' :: FieldToMatch -> Maybe QueryString
$sel:method:FieldToMatch' :: FieldToMatch -> Maybe Method
$sel:jsonBody:FieldToMatch' :: FieldToMatch -> Maybe JsonBody
$sel:headers:FieldToMatch' :: FieldToMatch -> Maybe Headers
$sel:cookies:FieldToMatch' :: FieldToMatch -> Maybe Cookies
$sel:body:FieldToMatch' :: FieldToMatch -> Maybe Body
$sel:allQueryArguments:FieldToMatch' :: FieldToMatch -> Maybe AllQueryArguments
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AllQueryArguments
allQueryArguments
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Body
body
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Cookies
cookies
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Headers
headers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe JsonBody
jsonBody
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Method
method
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe QueryString
queryString
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SingleHeader
singleHeader
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SingleQueryArgument
singleQueryArgument
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UriPath
uriPath

instance Data.ToJSON FieldToMatch where
  toJSON :: FieldToMatch -> Value
toJSON FieldToMatch' {Maybe AllQueryArguments
Maybe Method
Maybe JsonBody
Maybe Headers
Maybe Cookies
Maybe Body
Maybe QueryString
Maybe SingleHeader
Maybe SingleQueryArgument
Maybe UriPath
uriPath :: Maybe UriPath
singleQueryArgument :: Maybe SingleQueryArgument
singleHeader :: Maybe SingleHeader
queryString :: Maybe QueryString
method :: Maybe Method
jsonBody :: Maybe JsonBody
headers :: Maybe Headers
cookies :: Maybe Cookies
body :: Maybe Body
allQueryArguments :: Maybe AllQueryArguments
$sel:uriPath:FieldToMatch' :: FieldToMatch -> Maybe UriPath
$sel:singleQueryArgument:FieldToMatch' :: FieldToMatch -> Maybe SingleQueryArgument
$sel:singleHeader:FieldToMatch' :: FieldToMatch -> Maybe SingleHeader
$sel:queryString:FieldToMatch' :: FieldToMatch -> Maybe QueryString
$sel:method:FieldToMatch' :: FieldToMatch -> Maybe Method
$sel:jsonBody:FieldToMatch' :: FieldToMatch -> Maybe JsonBody
$sel:headers:FieldToMatch' :: FieldToMatch -> Maybe Headers
$sel:cookies:FieldToMatch' :: FieldToMatch -> Maybe Cookies
$sel:body:FieldToMatch' :: FieldToMatch -> Maybe Body
$sel:allQueryArguments:FieldToMatch' :: FieldToMatch -> Maybe AllQueryArguments
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AllQueryArguments" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AllQueryArguments
allQueryArguments,
            (Key
"Body" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Body
body,
            (Key
"Cookies" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Cookies
cookies,
            (Key
"Headers" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Headers
headers,
            (Key
"JsonBody" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe JsonBody
jsonBody,
            (Key
"Method" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Method
method,
            (Key
"QueryString" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe QueryString
queryString,
            (Key
"SingleHeader" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SingleHeader
singleHeader,
            (Key
"SingleQueryArgument" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SingleQueryArgument
singleQueryArgument,
            (Key
"UriPath" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UriPath
uriPath
          ]
      )