{-# 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.WAF.GetSampledRequests
-- 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)
--
-- 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.WAF.GetSampledRequests
  ( -- * Creating a Request
    GetSampledRequests (..),
    newGetSampledRequests,

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

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

    -- * Response Lenses
    getSampledRequestsResponse_sampledRequests,
    getSampledRequestsResponse_populationSize,
    getSampledRequestsResponse_timeWindow,
    getSampledRequestsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WAF.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
(GetSampledRequests -> GetSampledRequests -> Bool)
-> (GetSampledRequests -> GetSampledRequests -> Bool)
-> Eq GetSampledRequests
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]
(Int -> ReadS GetSampledRequests)
-> ReadS [GetSampledRequests]
-> ReadPrec GetSampledRequests
-> ReadPrec [GetSampledRequests]
-> Read 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
(Int -> GetSampledRequests -> ShowS)
-> (GetSampledRequests -> String)
-> ([GetSampledRequests] -> ShowS)
-> Show GetSampledRequests
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. GetSampledRequests -> Rep GetSampledRequests x)
-> (forall x. Rep GetSampledRequests x -> GetSampledRequests)
-> Generic GetSampledRequests
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' :: Text -> Text -> TimeWindow -> Natural -> GetSampledRequests
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 :: (Text -> f Text) -> GetSampledRequests -> f GetSampledRequests
getSampledRequests_webAclId = (GetSampledRequests -> Text)
-> (GetSampledRequests -> Text -> GetSampledRequests)
-> Lens GetSampledRequests GetSampledRequests Text Text
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 :: (Text -> f Text) -> GetSampledRequests -> f GetSampledRequests
getSampledRequests_ruleId = (GetSampledRequests -> Text)
-> (GetSampledRequests -> Text -> GetSampledRequests)
-> Lens GetSampledRequests GetSampledRequests Text Text
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 :: (TimeWindow -> f TimeWindow)
-> GetSampledRequests -> f GetSampledRequests
getSampledRequests_timeWindow = (GetSampledRequests -> TimeWindow)
-> (GetSampledRequests -> TimeWindow -> GetSampledRequests)
-> Lens GetSampledRequests GetSampledRequests TimeWindow 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 :: (Natural -> f Natural)
-> GetSampledRequests -> f GetSampledRequests
getSampledRequests_maxItems = (GetSampledRequests -> Natural)
-> (GetSampledRequests -> Natural -> GetSampledRequests)
-> Lens GetSampledRequests GetSampledRequests Natural Natural
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 :: GetSampledRequests -> Request GetSampledRequests
request = Service -> GetSampledRequests -> Request GetSampledRequests
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetSampledRequests
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSampledRequests)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetSampledRequests))
-> Logger
-> Service
-> Proxy GetSampledRequests
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetSampledRequests)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [SampledHTTPRequest]
-> Maybe Integer
-> Maybe TimeWindow
-> Int
-> GetSampledRequestsResponse
GetSampledRequestsResponse'
            (Maybe [SampledHTTPRequest]
 -> Maybe Integer
 -> Maybe TimeWindow
 -> Int
 -> GetSampledRequestsResponse)
-> Either String (Maybe [SampledHTTPRequest])
-> Either
     String
     (Maybe Integer
      -> Maybe TimeWindow -> Int -> GetSampledRequestsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [SampledHTTPRequest]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SampledRequests"
                            Either String (Maybe (Maybe [SampledHTTPRequest]))
-> Maybe [SampledHTTPRequest]
-> Either String (Maybe [SampledHTTPRequest])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [SampledHTTPRequest]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String
  (Maybe Integer
   -> Maybe TimeWindow -> Int -> GetSampledRequestsResponse)
-> Either String (Maybe Integer)
-> Either
     String (Maybe TimeWindow -> Int -> GetSampledRequestsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"PopulationSize")
            Either
  String (Maybe TimeWindow -> Int -> GetSampledRequestsResponse)
-> Either String (Maybe TimeWindow)
-> Either String (Int -> GetSampledRequestsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe TimeWindow)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TimeWindow")
            Either String (Int -> GetSampledRequestsResponse)
-> Either String Int -> Either String GetSampledRequestsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetSampledRequests

instance Prelude.NFData GetSampledRequests

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

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"WebAclId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
webAclId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RuleId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
ruleId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TimeWindow" Text -> TimeWindow -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TimeWindow
timeWindow),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MaxItems" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
maxItems)
          ]
      )

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

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

-- | /See:/ 'newGetSampledRequestsResponse' smart constructor.
data GetSampledRequestsResponse = GetSampledRequestsResponse'
  { -- | A complex type that contains detailed information about each of the
    -- requests in the sample.
    GetSampledRequestsResponse -> Maybe [SampledHTTPRequest]
sampledRequests :: Prelude.Maybe [SampledHTTPRequest],
    -- | 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,
    -- | 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
(GetSampledRequestsResponse -> GetSampledRequestsResponse -> Bool)
-> (GetSampledRequestsResponse
    -> GetSampledRequestsResponse -> Bool)
-> Eq GetSampledRequestsResponse
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]
(Int -> ReadS GetSampledRequestsResponse)
-> ReadS [GetSampledRequestsResponse]
-> ReadPrec GetSampledRequestsResponse
-> ReadPrec [GetSampledRequestsResponse]
-> Read 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
(Int -> GetSampledRequestsResponse -> ShowS)
-> (GetSampledRequestsResponse -> String)
-> ([GetSampledRequestsResponse] -> ShowS)
-> Show GetSampledRequestsResponse
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.
 GetSampledRequestsResponse -> Rep GetSampledRequestsResponse x)
-> (forall x.
    Rep GetSampledRequestsResponse x -> GetSampledRequestsResponse)
-> Generic GetSampledRequestsResponse
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:
--
-- 'sampledRequests', 'getSampledRequestsResponse_sampledRequests' - A complex type that contains detailed information about each of the
-- requests in the sample.
--
-- '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.
--
-- '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' :: Maybe [SampledHTTPRequest]
-> Maybe Integer
-> Maybe TimeWindow
-> Int
-> GetSampledRequestsResponse
GetSampledRequestsResponse'
    { $sel:sampledRequests:GetSampledRequestsResponse' :: Maybe [SampledHTTPRequest]
sampledRequests =
        Maybe [SampledHTTPRequest]
forall a. Maybe a
Prelude.Nothing,
      $sel:populationSize:GetSampledRequestsResponse' :: Maybe Integer
populationSize = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:timeWindow:GetSampledRequestsResponse' :: Maybe TimeWindow
timeWindow = Maybe TimeWindow
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetSampledRequestsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | 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 :: (Maybe [SampledHTTPRequest] -> f (Maybe [SampledHTTPRequest]))
-> GetSampledRequestsResponse -> f GetSampledRequestsResponse
getSampledRequestsResponse_sampledRequests = (GetSampledRequestsResponse -> Maybe [SampledHTTPRequest])
-> (GetSampledRequestsResponse
    -> Maybe [SampledHTTPRequest] -> GetSampledRequestsResponse)
-> Lens
     GetSampledRequestsResponse
     GetSampledRequestsResponse
     (Maybe [SampledHTTPRequest])
     (Maybe [SampledHTTPRequest])
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) ((Maybe [SampledHTTPRequest] -> f (Maybe [SampledHTTPRequest]))
 -> GetSampledRequestsResponse -> f GetSampledRequestsResponse)
-> ((Maybe [SampledHTTPRequest] -> f (Maybe [SampledHTTPRequest]))
    -> Maybe [SampledHTTPRequest] -> f (Maybe [SampledHTTPRequest]))
-> (Maybe [SampledHTTPRequest] -> f (Maybe [SampledHTTPRequest]))
-> GetSampledRequestsResponse
-> f GetSampledRequestsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SampledHTTPRequest]
  [SampledHTTPRequest]
  [SampledHTTPRequest]
  [SampledHTTPRequest]
-> Iso
     (Maybe [SampledHTTPRequest])
     (Maybe [SampledHTTPRequest])
     (Maybe [SampledHTTPRequest])
     (Maybe [SampledHTTPRequest])
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 AnIso
  [SampledHTTPRequest]
  [SampledHTTPRequest]
  [SampledHTTPRequest]
  [SampledHTTPRequest]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: (Maybe Integer -> f (Maybe Integer))
-> GetSampledRequestsResponse -> f GetSampledRequestsResponse
getSampledRequestsResponse_populationSize = (GetSampledRequestsResponse -> Maybe Integer)
-> (GetSampledRequestsResponse
    -> Maybe Integer -> GetSampledRequestsResponse)
-> Lens
     GetSampledRequestsResponse
     GetSampledRequestsResponse
     (Maybe Integer)
     (Maybe Integer)
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)

-- | 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 :: (Maybe TimeWindow -> f (Maybe TimeWindow))
-> GetSampledRequestsResponse -> f GetSampledRequestsResponse
getSampledRequestsResponse_timeWindow = (GetSampledRequestsResponse -> Maybe TimeWindow)
-> (GetSampledRequestsResponse
    -> Maybe TimeWindow -> GetSampledRequestsResponse)
-> Lens
     GetSampledRequestsResponse
     GetSampledRequestsResponse
     (Maybe TimeWindow)
     (Maybe 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 :: (Int -> f Int)
-> GetSampledRequestsResponse -> f GetSampledRequestsResponse
getSampledRequestsResponse_httpStatus = (GetSampledRequestsResponse -> Int)
-> (GetSampledRequestsResponse
    -> Int -> GetSampledRequestsResponse)
-> Lens
     GetSampledRequestsResponse GetSampledRequestsResponse Int Int
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