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

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

-- |
-- Module      : Amazonka.WAFRegional.GetSampledRequests
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- This is __AWS WAF Classic__ documentation. For more information, see
-- <https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html AWS WAF Classic>
-- in the developer guide.
--
-- __For the latest version of AWS WAF__, use the AWS WAFV2 API and see the
-- <https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html AWS WAF Developer Guide>.
-- With the latest version, AWS WAF has a single set of endpoints for
-- regional and global use.
--
-- Gets detailed information about a specified number of requests--a
-- sample--that AWS WAF randomly selects from among the first 5,000
-- requests that your AWS resource received during a time range that you
-- choose. You can specify a sample size of up to 500 requests, and you can
-- specify any time range in the previous three hours.
--
-- @GetSampledRequests@ returns a time range, which is usually the time
-- range that you specified. However, if your resource (such as a
-- CloudFront distribution) received 5,000 requests before the specified
-- time range elapsed, @GetSampledRequests@ returns an updated time range.
-- This new time range indicates the actual period during which AWS WAF
-- selected the requests in the sample.
module Amazonka.WAFRegional.GetSampledRequests
  ( -- * Creating a Request
    GetSampledRequests (..),
    newGetSampledRequests,

    -- * Request Lenses
    getSampledRequests_webAclId,
    getSampledRequests_ruleId,
    getSampledRequests_timeWindow,
    getSampledRequests_maxItems,

    -- * Destructuring the Response
    GetSampledRequestsResponse (..),
    newGetSampledRequestsResponse,

    -- * Response Lenses
    getSampledRequestsResponse_populationSize,
    getSampledRequestsResponse_sampledRequests,
    getSampledRequestsResponse_timeWindow,
    getSampledRequestsResponse_httpStatus,
  )
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 qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WAFRegional.Types

-- | /See:/ 'newGetSampledRequests' smart constructor.
data GetSampledRequests = GetSampledRequests'
  { -- | The @WebACLId@ of the @WebACL@ for which you want @GetSampledRequests@
    -- to return a sample of requests.
    GetSampledRequests -> Text
webAclId :: Prelude.Text,
    -- | @RuleId@ is one of three values:
    --
    -- -   The @RuleId@ of the @Rule@ or the @RuleGroupId@ of the @RuleGroup@
    --     for which you want @GetSampledRequests@ to return a sample of
    --     requests.
    --
    -- -   @Default_Action@, which causes @GetSampledRequests@ to return a
    --     sample of the requests that didn\'t match any of the rules in the
    --     specified @WebACL@.
    GetSampledRequests -> Text
ruleId :: Prelude.Text,
    -- | The start date and time and the end date and time of the range for which
    -- you want @GetSampledRequests@ to return a sample of requests. You must
    -- specify the times in Coordinated Universal Time (UTC) format. UTC format
    -- includes the special designator, @Z@. For example,
    -- @\"2016-09-27T14:50Z\"@. You can specify any time range in the previous
    -- three hours.
    GetSampledRequests -> TimeWindow
timeWindow :: TimeWindow,
    -- | The number of requests that you want AWS WAF to return from among the
    -- first 5,000 requests that your AWS resource received during the time
    -- range. If your resource received fewer requests than the value of
    -- @MaxItems@, @GetSampledRequests@ returns information about all of them.
    GetSampledRequests -> Natural
maxItems :: Prelude.Natural
  }
  deriving (GetSampledRequests -> GetSampledRequests -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSampledRequests -> GetSampledRequests -> Bool
$c/= :: GetSampledRequests -> GetSampledRequests -> Bool
== :: GetSampledRequests -> GetSampledRequests -> Bool
$c== :: GetSampledRequests -> GetSampledRequests -> Bool
Prelude.Eq, ReadPrec [GetSampledRequests]
ReadPrec GetSampledRequests
Int -> ReadS GetSampledRequests
ReadS [GetSampledRequests]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSampledRequests]
$creadListPrec :: ReadPrec [GetSampledRequests]
readPrec :: ReadPrec GetSampledRequests
$creadPrec :: ReadPrec GetSampledRequests
readList :: ReadS [GetSampledRequests]
$creadList :: ReadS [GetSampledRequests]
readsPrec :: Int -> ReadS GetSampledRequests
$creadsPrec :: Int -> ReadS GetSampledRequests
Prelude.Read, Int -> GetSampledRequests -> ShowS
[GetSampledRequests] -> ShowS
GetSampledRequests -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSampledRequests] -> ShowS
$cshowList :: [GetSampledRequests] -> ShowS
show :: GetSampledRequests -> String
$cshow :: GetSampledRequests -> String
showsPrec :: Int -> GetSampledRequests -> ShowS
$cshowsPrec :: Int -> GetSampledRequests -> ShowS
Prelude.Show, forall x. Rep GetSampledRequests x -> GetSampledRequests
forall x. GetSampledRequests -> Rep GetSampledRequests x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSampledRequests x -> GetSampledRequests
$cfrom :: forall x. GetSampledRequests -> Rep GetSampledRequests x
Prelude.Generic)

-- |
-- Create a value of 'GetSampledRequests' 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:
--
-- 'webAclId', 'getSampledRequests_webAclId' - The @WebACLId@ of the @WebACL@ for which you want @GetSampledRequests@
-- to return a sample of requests.
--
-- 'ruleId', 'getSampledRequests_ruleId' - @RuleId@ is one of three values:
--
-- -   The @RuleId@ of the @Rule@ or the @RuleGroupId@ of the @RuleGroup@
--     for which you want @GetSampledRequests@ to return a sample of
--     requests.
--
-- -   @Default_Action@, which causes @GetSampledRequests@ to return a
--     sample of the requests that didn\'t match any of the rules in the
--     specified @WebACL@.
--
-- 'timeWindow', 'getSampledRequests_timeWindow' - The start date and time and the end date and time of the range for which
-- you want @GetSampledRequests@ to return a sample of requests. You must
-- specify the times in Coordinated Universal Time (UTC) format. UTC format
-- includes the special designator, @Z@. For example,
-- @\"2016-09-27T14:50Z\"@. You can specify any time range in the previous
-- three hours.
--
-- 'maxItems', 'getSampledRequests_maxItems' - The number of requests that you want AWS WAF to return from among the
-- first 5,000 requests that your AWS resource received during the time
-- range. If your resource received fewer requests than the value of
-- @MaxItems@, @GetSampledRequests@ returns information about all of them.
newGetSampledRequests ::
  -- | 'webAclId'
  Prelude.Text ->
  -- | 'ruleId'
  Prelude.Text ->
  -- | 'timeWindow'
  TimeWindow ->
  -- | 'maxItems'
  Prelude.Natural ->
  GetSampledRequests
newGetSampledRequests :: Text -> Text -> TimeWindow -> Natural -> GetSampledRequests
newGetSampledRequests
  Text
pWebAclId_
  Text
pRuleId_
  TimeWindow
pTimeWindow_
  Natural
pMaxItems_ =
    GetSampledRequests'
      { $sel:webAclId:GetSampledRequests' :: Text
webAclId = Text
pWebAclId_,
        $sel:ruleId:GetSampledRequests' :: Text
ruleId = Text
pRuleId_,
        $sel:timeWindow:GetSampledRequests' :: TimeWindow
timeWindow = TimeWindow
pTimeWindow_,
        $sel:maxItems:GetSampledRequests' :: Natural
maxItems = Natural
pMaxItems_
      }

-- | The @WebACLId@ of the @WebACL@ for which you want @GetSampledRequests@
-- to return a sample of requests.
getSampledRequests_webAclId :: Lens.Lens' GetSampledRequests Prelude.Text
getSampledRequests_webAclId :: Lens' GetSampledRequests Text
getSampledRequests_webAclId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSampledRequests' {Text
webAclId :: Text
$sel:webAclId:GetSampledRequests' :: GetSampledRequests -> Text
webAclId} -> Text
webAclId) (\s :: GetSampledRequests
s@GetSampledRequests' {} Text
a -> GetSampledRequests
s {$sel:webAclId:GetSampledRequests' :: Text
webAclId = Text
a} :: GetSampledRequests)

-- | @RuleId@ is one of three values:
--
-- -   The @RuleId@ of the @Rule@ or the @RuleGroupId@ of the @RuleGroup@
--     for which you want @GetSampledRequests@ to return a sample of
--     requests.
--
-- -   @Default_Action@, which causes @GetSampledRequests@ to return a
--     sample of the requests that didn\'t match any of the rules in the
--     specified @WebACL@.
getSampledRequests_ruleId :: Lens.Lens' GetSampledRequests Prelude.Text
getSampledRequests_ruleId :: Lens' GetSampledRequests Text
getSampledRequests_ruleId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSampledRequests' {Text
ruleId :: Text
$sel:ruleId:GetSampledRequests' :: GetSampledRequests -> Text
ruleId} -> Text
ruleId) (\s :: GetSampledRequests
s@GetSampledRequests' {} Text
a -> GetSampledRequests
s {$sel:ruleId:GetSampledRequests' :: Text
ruleId = Text
a} :: GetSampledRequests)

-- | The start date and time and the end date and time of the range for which
-- you want @GetSampledRequests@ to return a sample of requests. You must
-- specify the times in Coordinated Universal Time (UTC) format. UTC format
-- includes the special designator, @Z@. For example,
-- @\"2016-09-27T14:50Z\"@. You can specify any time range in the previous
-- three hours.
getSampledRequests_timeWindow :: Lens.Lens' GetSampledRequests TimeWindow
getSampledRequests_timeWindow :: Lens' GetSampledRequests TimeWindow
getSampledRequests_timeWindow = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSampledRequests' {TimeWindow
timeWindow :: TimeWindow
$sel:timeWindow:GetSampledRequests' :: GetSampledRequests -> TimeWindow
timeWindow} -> TimeWindow
timeWindow) (\s :: GetSampledRequests
s@GetSampledRequests' {} TimeWindow
a -> GetSampledRequests
s {$sel:timeWindow:GetSampledRequests' :: TimeWindow
timeWindow = TimeWindow
a} :: GetSampledRequests)

-- | The number of requests that you want AWS WAF to return from among the
-- first 5,000 requests that your AWS resource received during the time
-- range. If your resource received fewer requests than the value of
-- @MaxItems@, @GetSampledRequests@ returns information about all of them.
getSampledRequests_maxItems :: Lens.Lens' GetSampledRequests Prelude.Natural
getSampledRequests_maxItems :: Lens' GetSampledRequests Natural
getSampledRequests_maxItems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSampledRequests' {Natural
maxItems :: Natural
$sel:maxItems:GetSampledRequests' :: GetSampledRequests -> Natural
maxItems} -> Natural
maxItems) (\s :: GetSampledRequests
s@GetSampledRequests' {} Natural
a -> GetSampledRequests
s {$sel:maxItems:GetSampledRequests' :: Natural
maxItems = Natural
a} :: GetSampledRequests)

instance Core.AWSRequest GetSampledRequests where
  type
    AWSResponse GetSampledRequests =
      GetSampledRequestsResponse
  request :: (Service -> Service)
-> GetSampledRequests -> Request GetSampledRequests
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetSampledRequests
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSampledRequests)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Integer
-> Maybe [SampledHTTPRequest]
-> Maybe TimeWindow
-> Int
-> GetSampledRequestsResponse
GetSampledRequestsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"PopulationSize")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"SampledRequests"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"TimeWindow")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetSampledRequests where
  hashWithSalt :: Int -> GetSampledRequests -> Int
hashWithSalt Int
_salt GetSampledRequests' {Natural
Text
TimeWindow
maxItems :: Natural
timeWindow :: TimeWindow
ruleId :: Text
webAclId :: Text
$sel:maxItems:GetSampledRequests' :: GetSampledRequests -> Natural
$sel:timeWindow:GetSampledRequests' :: GetSampledRequests -> TimeWindow
$sel:ruleId:GetSampledRequests' :: GetSampledRequests -> Text
$sel:webAclId:GetSampledRequests' :: GetSampledRequests -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
webAclId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ruleId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TimeWindow
timeWindow
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
maxItems

instance Prelude.NFData GetSampledRequests where
  rnf :: GetSampledRequests -> ()
rnf GetSampledRequests' {Natural
Text
TimeWindow
maxItems :: Natural
timeWindow :: TimeWindow
ruleId :: Text
webAclId :: Text
$sel:maxItems:GetSampledRequests' :: GetSampledRequests -> Natural
$sel:timeWindow:GetSampledRequests' :: GetSampledRequests -> TimeWindow
$sel:ruleId:GetSampledRequests' :: GetSampledRequests -> Text
$sel:webAclId:GetSampledRequests' :: GetSampledRequests -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
webAclId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
ruleId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf TimeWindow
timeWindow
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
maxItems

instance Data.ToHeaders GetSampledRequests where
  toHeaders :: GetSampledRequests -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSWAF_Regional_20161128.GetSampledRequests" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON GetSampledRequests where
  toJSON :: GetSampledRequests -> Value
toJSON GetSampledRequests' {Natural
Text
TimeWindow
maxItems :: Natural
timeWindow :: TimeWindow
ruleId :: Text
webAclId :: Text
$sel:maxItems:GetSampledRequests' :: GetSampledRequests -> Natural
$sel:timeWindow:GetSampledRequests' :: GetSampledRequests -> TimeWindow
$sel:ruleId:GetSampledRequests' :: GetSampledRequests -> Text
$sel:webAclId:GetSampledRequests' :: GetSampledRequests -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"WebAclId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
webAclId),
            forall a. a -> Maybe a
Prelude.Just (Key
"RuleId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
ruleId),
            forall a. a -> Maybe a
Prelude.Just (Key
"TimeWindow" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= TimeWindow
timeWindow),
            forall a. a -> Maybe a
Prelude.Just (Key
"MaxItems" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
maxItems)
          ]
      )

instance Data.ToPath GetSampledRequests where
  toPath :: GetSampledRequests -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery GetSampledRequests where
  toQuery :: GetSampledRequests -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetSampledRequestsResponse' smart constructor.
data GetSampledRequestsResponse = GetSampledRequestsResponse'
  { -- | The total number of requests from which @GetSampledRequests@ got a
    -- sample of @MaxItems@ requests. If @PopulationSize@ is less than
    -- @MaxItems@, the sample includes every request that your AWS resource
    -- received during the specified time range.
    GetSampledRequestsResponse -> Maybe Integer
populationSize :: Prelude.Maybe Prelude.Integer,
    -- | A complex type that contains detailed information about each of the
    -- requests in the sample.
    GetSampledRequestsResponse -> Maybe [SampledHTTPRequest]
sampledRequests :: Prelude.Maybe [SampledHTTPRequest],
    -- | Usually, @TimeWindow@ is the time range that you specified in the
    -- @GetSampledRequests@ request. However, if your AWS resource received
    -- more than 5,000 requests during the time range that you specified in the
    -- request, @GetSampledRequests@ returns the time range for the first 5,000
    -- requests. Times are in Coordinated Universal Time (UTC) format.
    GetSampledRequestsResponse -> Maybe TimeWindow
timeWindow :: Prelude.Maybe TimeWindow,
    -- | The response's http status code.
    GetSampledRequestsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetSampledRequestsResponse -> GetSampledRequestsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSampledRequestsResponse -> GetSampledRequestsResponse -> Bool
$c/= :: GetSampledRequestsResponse -> GetSampledRequestsResponse -> Bool
== :: GetSampledRequestsResponse -> GetSampledRequestsResponse -> Bool
$c== :: GetSampledRequestsResponse -> GetSampledRequestsResponse -> Bool
Prelude.Eq, ReadPrec [GetSampledRequestsResponse]
ReadPrec GetSampledRequestsResponse
Int -> ReadS GetSampledRequestsResponse
ReadS [GetSampledRequestsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSampledRequestsResponse]
$creadListPrec :: ReadPrec [GetSampledRequestsResponse]
readPrec :: ReadPrec GetSampledRequestsResponse
$creadPrec :: ReadPrec GetSampledRequestsResponse
readList :: ReadS [GetSampledRequestsResponse]
$creadList :: ReadS [GetSampledRequestsResponse]
readsPrec :: Int -> ReadS GetSampledRequestsResponse
$creadsPrec :: Int -> ReadS GetSampledRequestsResponse
Prelude.Read, Int -> GetSampledRequestsResponse -> ShowS
[GetSampledRequestsResponse] -> ShowS
GetSampledRequestsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSampledRequestsResponse] -> ShowS
$cshowList :: [GetSampledRequestsResponse] -> ShowS
show :: GetSampledRequestsResponse -> String
$cshow :: GetSampledRequestsResponse -> String
showsPrec :: Int -> GetSampledRequestsResponse -> ShowS
$cshowsPrec :: Int -> GetSampledRequestsResponse -> ShowS
Prelude.Show, forall x.
Rep GetSampledRequestsResponse x -> GetSampledRequestsResponse
forall x.
GetSampledRequestsResponse -> Rep GetSampledRequestsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSampledRequestsResponse x -> GetSampledRequestsResponse
$cfrom :: forall x.
GetSampledRequestsResponse -> Rep GetSampledRequestsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetSampledRequestsResponse' 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:
--
-- 'populationSize', 'getSampledRequestsResponse_populationSize' - The total number of requests from which @GetSampledRequests@ got a
-- sample of @MaxItems@ requests. If @PopulationSize@ is less than
-- @MaxItems@, the sample includes every request that your AWS resource
-- received during the specified time range.
--
-- 'sampledRequests', 'getSampledRequestsResponse_sampledRequests' - A complex type that contains detailed information about each of the
-- requests in the sample.
--
-- 'timeWindow', 'getSampledRequestsResponse_timeWindow' - Usually, @TimeWindow@ is the time range that you specified in the
-- @GetSampledRequests@ request. However, if your AWS resource received
-- more than 5,000 requests during the time range that you specified in the
-- request, @GetSampledRequests@ returns the time range for the first 5,000
-- requests. Times are in Coordinated Universal Time (UTC) format.
--
-- 'httpStatus', 'getSampledRequestsResponse_httpStatus' - The response's http status code.
newGetSampledRequestsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetSampledRequestsResponse
newGetSampledRequestsResponse :: Int -> GetSampledRequestsResponse
newGetSampledRequestsResponse Int
pHttpStatus_ =
  GetSampledRequestsResponse'
    { $sel:populationSize:GetSampledRequestsResponse' :: Maybe Integer
populationSize =
        forall a. Maybe a
Prelude.Nothing,
      $sel:sampledRequests:GetSampledRequestsResponse' :: Maybe [SampledHTTPRequest]
sampledRequests = forall a. Maybe a
Prelude.Nothing,
      $sel:timeWindow:GetSampledRequestsResponse' :: Maybe TimeWindow
timeWindow = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetSampledRequestsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The total number of requests from which @GetSampledRequests@ got a
-- sample of @MaxItems@ requests. If @PopulationSize@ is less than
-- @MaxItems@, the sample includes every request that your AWS resource
-- received during the specified time range.
getSampledRequestsResponse_populationSize :: Lens.Lens' GetSampledRequestsResponse (Prelude.Maybe Prelude.Integer)
getSampledRequestsResponse_populationSize :: Lens' GetSampledRequestsResponse (Maybe Integer)
getSampledRequestsResponse_populationSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSampledRequestsResponse' {Maybe Integer
populationSize :: Maybe Integer
$sel:populationSize:GetSampledRequestsResponse' :: GetSampledRequestsResponse -> Maybe Integer
populationSize} -> Maybe Integer
populationSize) (\s :: GetSampledRequestsResponse
s@GetSampledRequestsResponse' {} Maybe Integer
a -> GetSampledRequestsResponse
s {$sel:populationSize:GetSampledRequestsResponse' :: Maybe Integer
populationSize = Maybe Integer
a} :: GetSampledRequestsResponse)

-- | A complex type that contains detailed information about each of the
-- requests in the sample.
getSampledRequestsResponse_sampledRequests :: Lens.Lens' GetSampledRequestsResponse (Prelude.Maybe [SampledHTTPRequest])
getSampledRequestsResponse_sampledRequests :: Lens' GetSampledRequestsResponse (Maybe [SampledHTTPRequest])
getSampledRequestsResponse_sampledRequests = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSampledRequestsResponse' {Maybe [SampledHTTPRequest]
sampledRequests :: Maybe [SampledHTTPRequest]
$sel:sampledRequests:GetSampledRequestsResponse' :: GetSampledRequestsResponse -> Maybe [SampledHTTPRequest]
sampledRequests} -> Maybe [SampledHTTPRequest]
sampledRequests) (\s :: GetSampledRequestsResponse
s@GetSampledRequestsResponse' {} Maybe [SampledHTTPRequest]
a -> GetSampledRequestsResponse
s {$sel:sampledRequests:GetSampledRequestsResponse' :: Maybe [SampledHTTPRequest]
sampledRequests = Maybe [SampledHTTPRequest]
a} :: GetSampledRequestsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Usually, @TimeWindow@ is the time range that you specified in the
-- @GetSampledRequests@ request. However, if your AWS resource received
-- more than 5,000 requests during the time range that you specified in the
-- request, @GetSampledRequests@ returns the time range for the first 5,000
-- requests. Times are in Coordinated Universal Time (UTC) format.
getSampledRequestsResponse_timeWindow :: Lens.Lens' GetSampledRequestsResponse (Prelude.Maybe TimeWindow)
getSampledRequestsResponse_timeWindow :: Lens' GetSampledRequestsResponse (Maybe TimeWindow)
getSampledRequestsResponse_timeWindow = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSampledRequestsResponse' {Maybe TimeWindow
timeWindow :: Maybe TimeWindow
$sel:timeWindow:GetSampledRequestsResponse' :: GetSampledRequestsResponse -> Maybe TimeWindow
timeWindow} -> Maybe TimeWindow
timeWindow) (\s :: GetSampledRequestsResponse
s@GetSampledRequestsResponse' {} Maybe TimeWindow
a -> GetSampledRequestsResponse
s {$sel:timeWindow:GetSampledRequestsResponse' :: Maybe TimeWindow
timeWindow = Maybe TimeWindow
a} :: GetSampledRequestsResponse)

-- | The response's http status code.
getSampledRequestsResponse_httpStatus :: Lens.Lens' GetSampledRequestsResponse Prelude.Int
getSampledRequestsResponse_httpStatus :: Lens' GetSampledRequestsResponse Int
getSampledRequestsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSampledRequestsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetSampledRequestsResponse' :: GetSampledRequestsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetSampledRequestsResponse
s@GetSampledRequestsResponse' {} Int
a -> GetSampledRequestsResponse
s {$sel:httpStatus:GetSampledRequestsResponse' :: Int
httpStatus = Int
a} :: GetSampledRequestsResponse)

instance Prelude.NFData GetSampledRequestsResponse where
  rnf :: GetSampledRequestsResponse -> ()
rnf GetSampledRequestsResponse' {Int
Maybe Integer
Maybe [SampledHTTPRequest]
Maybe TimeWindow
httpStatus :: Int
timeWindow :: Maybe TimeWindow
sampledRequests :: Maybe [SampledHTTPRequest]
populationSize :: Maybe Integer
$sel:httpStatus:GetSampledRequestsResponse' :: GetSampledRequestsResponse -> Int
$sel:timeWindow:GetSampledRequestsResponse' :: GetSampledRequestsResponse -> Maybe TimeWindow
$sel:sampledRequests:GetSampledRequestsResponse' :: GetSampledRequestsResponse -> Maybe [SampledHTTPRequest]
$sel:populationSize:GetSampledRequestsResponse' :: GetSampledRequestsResponse -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
populationSize
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [SampledHTTPRequest]
sampledRequests
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TimeWindow
timeWindow
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus