{-# 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.Shield.ListAttacks
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns all ongoing DDoS attacks or all DDoS attacks during a specified
-- time period.
--
-- This operation returns paginated results.
module Amazonka.Shield.ListAttacks
  ( -- * Creating a Request
    ListAttacks (..),
    newListAttacks,

    -- * Request Lenses
    listAttacks_endTime,
    listAttacks_maxResults,
    listAttacks_nextToken,
    listAttacks_resourceArns,
    listAttacks_startTime,

    -- * Destructuring the Response
    ListAttacksResponse (..),
    newListAttacksResponse,

    -- * Response Lenses
    listAttacksResponse_attackSummaries,
    listAttacksResponse_nextToken,
    listAttacksResponse_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.Shield.Types

-- | /See:/ 'newListAttacks' smart constructor.
data ListAttacks = ListAttacks'
  { -- | The end of the time period for the attacks. This is a @timestamp@ type.
    -- The request syntax listing for this call indicates a @number@ type, but
    -- you can provide the time in any valid
    -- <https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-types.html#parameter-type-timestamp timestamp format>
    -- setting.
    ListAttacks -> Maybe TimeRange
endTime :: Prelude.Maybe TimeRange,
    -- | The greatest number of objects that you want Shield Advanced to return
    -- to the list request. Shield Advanced might return fewer objects than you
    -- indicate in this setting, even if more objects are available. If there
    -- are more objects remaining, Shield Advanced will always also return a
    -- @NextToken@ value in the response.
    --
    -- The default setting is 20.
    ListAttacks -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | When you request a list of objects from Shield Advanced, if the response
    -- does not include all of the remaining available objects, Shield Advanced
    -- includes a @NextToken@ value in the response. You can retrieve the next
    -- batch of objects by requesting the list again and providing the token
    -- that was returned by the prior call in your request.
    --
    -- You can indicate the maximum number of objects that you want Shield
    -- Advanced to return for a single call with the @MaxResults@ setting.
    -- Shield Advanced will not return more than @MaxResults@ objects, but may
    -- return fewer, even if more objects are still available.
    --
    -- Whenever more objects remain that Shield Advanced has not yet returned
    -- to you, the response will include a @NextToken@ value.
    --
    -- On your first call to a list operation, leave this setting empty.
    ListAttacks -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ARNs (Amazon Resource Names) of the resources that were attacked. If
    -- you leave this blank, all applicable resources for this account will be
    -- included.
    ListAttacks -> Maybe [Text]
resourceArns :: Prelude.Maybe [Prelude.Text],
    -- | The start of the time period for the attacks. This is a @timestamp@
    -- type. The request syntax listing for this call indicates a @number@
    -- type, but you can provide the time in any valid
    -- <https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-types.html#parameter-type-timestamp timestamp format>
    -- setting.
    ListAttacks -> Maybe TimeRange
startTime :: Prelude.Maybe TimeRange
  }
  deriving (ListAttacks -> ListAttacks -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAttacks -> ListAttacks -> Bool
$c/= :: ListAttacks -> ListAttacks -> Bool
== :: ListAttacks -> ListAttacks -> Bool
$c== :: ListAttacks -> ListAttacks -> Bool
Prelude.Eq, ReadPrec [ListAttacks]
ReadPrec ListAttacks
Int -> ReadS ListAttacks
ReadS [ListAttacks]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAttacks]
$creadListPrec :: ReadPrec [ListAttacks]
readPrec :: ReadPrec ListAttacks
$creadPrec :: ReadPrec ListAttacks
readList :: ReadS [ListAttacks]
$creadList :: ReadS [ListAttacks]
readsPrec :: Int -> ReadS ListAttacks
$creadsPrec :: Int -> ReadS ListAttacks
Prelude.Read, Int -> ListAttacks -> ShowS
[ListAttacks] -> ShowS
ListAttacks -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAttacks] -> ShowS
$cshowList :: [ListAttacks] -> ShowS
show :: ListAttacks -> String
$cshow :: ListAttacks -> String
showsPrec :: Int -> ListAttacks -> ShowS
$cshowsPrec :: Int -> ListAttacks -> ShowS
Prelude.Show, forall x. Rep ListAttacks x -> ListAttacks
forall x. ListAttacks -> Rep ListAttacks x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAttacks x -> ListAttacks
$cfrom :: forall x. ListAttacks -> Rep ListAttacks x
Prelude.Generic)

-- |
-- Create a value of 'ListAttacks' 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:
--
-- 'endTime', 'listAttacks_endTime' - The end of the time period for the attacks. This is a @timestamp@ type.
-- The request syntax listing for this call indicates a @number@ type, but
-- you can provide the time in any valid
-- <https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-types.html#parameter-type-timestamp timestamp format>
-- setting.
--
-- 'maxResults', 'listAttacks_maxResults' - The greatest number of objects that you want Shield Advanced to return
-- to the list request. Shield Advanced might return fewer objects than you
-- indicate in this setting, even if more objects are available. If there
-- are more objects remaining, Shield Advanced will always also return a
-- @NextToken@ value in the response.
--
-- The default setting is 20.
--
-- 'nextToken', 'listAttacks_nextToken' - When you request a list of objects from Shield Advanced, if the response
-- does not include all of the remaining available objects, Shield Advanced
-- includes a @NextToken@ value in the response. You can retrieve the next
-- batch of objects by requesting the list again and providing the token
-- that was returned by the prior call in your request.
--
-- You can indicate the maximum number of objects that you want Shield
-- Advanced to return for a single call with the @MaxResults@ setting.
-- Shield Advanced will not return more than @MaxResults@ objects, but may
-- return fewer, even if more objects are still available.
--
-- Whenever more objects remain that Shield Advanced has not yet returned
-- to you, the response will include a @NextToken@ value.
--
-- On your first call to a list operation, leave this setting empty.
--
-- 'resourceArns', 'listAttacks_resourceArns' - The ARNs (Amazon Resource Names) of the resources that were attacked. If
-- you leave this blank, all applicable resources for this account will be
-- included.
--
-- 'startTime', 'listAttacks_startTime' - The start of the time period for the attacks. This is a @timestamp@
-- type. The request syntax listing for this call indicates a @number@
-- type, but you can provide the time in any valid
-- <https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-types.html#parameter-type-timestamp timestamp format>
-- setting.
newListAttacks ::
  ListAttacks
newListAttacks :: ListAttacks
newListAttacks =
  ListAttacks'
    { $sel:endTime:ListAttacks' :: Maybe TimeRange
endTime = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAttacks' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAttacks' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceArns:ListAttacks' :: Maybe [Text]
resourceArns = forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:ListAttacks' :: Maybe TimeRange
startTime = forall a. Maybe a
Prelude.Nothing
    }

-- | The end of the time period for the attacks. This is a @timestamp@ type.
-- The request syntax listing for this call indicates a @number@ type, but
-- you can provide the time in any valid
-- <https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-types.html#parameter-type-timestamp timestamp format>
-- setting.
listAttacks_endTime :: Lens.Lens' ListAttacks (Prelude.Maybe TimeRange)
listAttacks_endTime :: Lens' ListAttacks (Maybe TimeRange)
listAttacks_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttacks' {Maybe TimeRange
endTime :: Maybe TimeRange
$sel:endTime:ListAttacks' :: ListAttacks -> Maybe TimeRange
endTime} -> Maybe TimeRange
endTime) (\s :: ListAttacks
s@ListAttacks' {} Maybe TimeRange
a -> ListAttacks
s {$sel:endTime:ListAttacks' :: Maybe TimeRange
endTime = Maybe TimeRange
a} :: ListAttacks)

-- | The greatest number of objects that you want Shield Advanced to return
-- to the list request. Shield Advanced might return fewer objects than you
-- indicate in this setting, even if more objects are available. If there
-- are more objects remaining, Shield Advanced will always also return a
-- @NextToken@ value in the response.
--
-- The default setting is 20.
listAttacks_maxResults :: Lens.Lens' ListAttacks (Prelude.Maybe Prelude.Natural)
listAttacks_maxResults :: Lens' ListAttacks (Maybe Natural)
listAttacks_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttacks' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAttacks' :: ListAttacks -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAttacks
s@ListAttacks' {} Maybe Natural
a -> ListAttacks
s {$sel:maxResults:ListAttacks' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAttacks)

-- | When you request a list of objects from Shield Advanced, if the response
-- does not include all of the remaining available objects, Shield Advanced
-- includes a @NextToken@ value in the response. You can retrieve the next
-- batch of objects by requesting the list again and providing the token
-- that was returned by the prior call in your request.
--
-- You can indicate the maximum number of objects that you want Shield
-- Advanced to return for a single call with the @MaxResults@ setting.
-- Shield Advanced will not return more than @MaxResults@ objects, but may
-- return fewer, even if more objects are still available.
--
-- Whenever more objects remain that Shield Advanced has not yet returned
-- to you, the response will include a @NextToken@ value.
--
-- On your first call to a list operation, leave this setting empty.
listAttacks_nextToken :: Lens.Lens' ListAttacks (Prelude.Maybe Prelude.Text)
listAttacks_nextToken :: Lens' ListAttacks (Maybe Text)
listAttacks_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttacks' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAttacks' :: ListAttacks -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAttacks
s@ListAttacks' {} Maybe Text
a -> ListAttacks
s {$sel:nextToken:ListAttacks' :: Maybe Text
nextToken = Maybe Text
a} :: ListAttacks)

-- | The ARNs (Amazon Resource Names) of the resources that were attacked. If
-- you leave this blank, all applicable resources for this account will be
-- included.
listAttacks_resourceArns :: Lens.Lens' ListAttacks (Prelude.Maybe [Prelude.Text])
listAttacks_resourceArns :: Lens' ListAttacks (Maybe [Text])
listAttacks_resourceArns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttacks' {Maybe [Text]
resourceArns :: Maybe [Text]
$sel:resourceArns:ListAttacks' :: ListAttacks -> Maybe [Text]
resourceArns} -> Maybe [Text]
resourceArns) (\s :: ListAttacks
s@ListAttacks' {} Maybe [Text]
a -> ListAttacks
s {$sel:resourceArns:ListAttacks' :: Maybe [Text]
resourceArns = Maybe [Text]
a} :: ListAttacks) 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

-- | The start of the time period for the attacks. This is a @timestamp@
-- type. The request syntax listing for this call indicates a @number@
-- type, but you can provide the time in any valid
-- <https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-types.html#parameter-type-timestamp timestamp format>
-- setting.
listAttacks_startTime :: Lens.Lens' ListAttacks (Prelude.Maybe TimeRange)
listAttacks_startTime :: Lens' ListAttacks (Maybe TimeRange)
listAttacks_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttacks' {Maybe TimeRange
startTime :: Maybe TimeRange
$sel:startTime:ListAttacks' :: ListAttacks -> Maybe TimeRange
startTime} -> Maybe TimeRange
startTime) (\s :: ListAttacks
s@ListAttacks' {} Maybe TimeRange
a -> ListAttacks
s {$sel:startTime:ListAttacks' :: Maybe TimeRange
startTime = Maybe TimeRange
a} :: ListAttacks)

instance Core.AWSPager ListAttacks where
  page :: ListAttacks -> AWSResponse ListAttacks -> Maybe ListAttacks
page ListAttacks
rq AWSResponse ListAttacks
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAttacks
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAttacksResponse (Maybe Text)
listAttacksResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAttacks
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAttacksResponse (Maybe [AttackSummary])
listAttacksResponse_attackSummaries
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListAttacks
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListAttacks (Maybe Text)
listAttacks_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAttacks
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAttacksResponse (Maybe Text)
listAttacksResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListAttacks where
  type AWSResponse ListAttacks = ListAttacksResponse
  request :: (Service -> Service) -> ListAttacks -> Request ListAttacks
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 ListAttacks
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAttacks)))
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 [AttackSummary] -> Maybe Text -> Int -> ListAttacksResponse
ListAttacksResponse'
            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
"AttackSummaries"
                            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
"NextToken")
            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 ListAttacks where
  hashWithSalt :: Int -> ListAttacks -> Int
hashWithSalt Int
_salt ListAttacks' {Maybe Natural
Maybe [Text]
Maybe Text
Maybe TimeRange
startTime :: Maybe TimeRange
resourceArns :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
endTime :: Maybe TimeRange
$sel:startTime:ListAttacks' :: ListAttacks -> Maybe TimeRange
$sel:resourceArns:ListAttacks' :: ListAttacks -> Maybe [Text]
$sel:nextToken:ListAttacks' :: ListAttacks -> Maybe Text
$sel:maxResults:ListAttacks' :: ListAttacks -> Maybe Natural
$sel:endTime:ListAttacks' :: ListAttacks -> Maybe TimeRange
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TimeRange
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
resourceArns
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TimeRange
startTime

instance Prelude.NFData ListAttacks where
  rnf :: ListAttacks -> ()
rnf ListAttacks' {Maybe Natural
Maybe [Text]
Maybe Text
Maybe TimeRange
startTime :: Maybe TimeRange
resourceArns :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
endTime :: Maybe TimeRange
$sel:startTime:ListAttacks' :: ListAttacks -> Maybe TimeRange
$sel:resourceArns:ListAttacks' :: ListAttacks -> Maybe [Text]
$sel:nextToken:ListAttacks' :: ListAttacks -> Maybe Text
$sel:maxResults:ListAttacks' :: ListAttacks -> Maybe Natural
$sel:endTime:ListAttacks' :: ListAttacks -> Maybe TimeRange
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe TimeRange
endTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
resourceArns
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TimeRange
startTime

instance Data.ToHeaders ListAttacks where
  toHeaders :: ListAttacks -> 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
"AWSShield_20160616.ListAttacks" ::
                          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 ListAttacks where
  toJSON :: ListAttacks -> Value
toJSON ListAttacks' {Maybe Natural
Maybe [Text]
Maybe Text
Maybe TimeRange
startTime :: Maybe TimeRange
resourceArns :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
endTime :: Maybe TimeRange
$sel:startTime:ListAttacks' :: ListAttacks -> Maybe TimeRange
$sel:resourceArns:ListAttacks' :: ListAttacks -> Maybe [Text]
$sel:nextToken:ListAttacks' :: ListAttacks -> Maybe Text
$sel:maxResults:ListAttacks' :: ListAttacks -> Maybe Natural
$sel:endTime:ListAttacks' :: ListAttacks -> Maybe TimeRange
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"EndTime" 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 TimeRange
endTime,
            (Key
"MaxResults" 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 Natural
maxResults,
            (Key
"NextToken" 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 Text
nextToken,
            (Key
"ResourceArns" 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 [Text]
resourceArns,
            (Key
"StartTime" 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 TimeRange
startTime
          ]
      )

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

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

-- | /See:/ 'newListAttacksResponse' smart constructor.
data ListAttacksResponse = ListAttacksResponse'
  { -- | The attack information for the specified time range.
    ListAttacksResponse -> Maybe [AttackSummary]
attackSummaries :: Prelude.Maybe [AttackSummary],
    -- | When you request a list of objects from Shield Advanced, if the response
    -- does not include all of the remaining available objects, Shield Advanced
    -- includes a @NextToken@ value in the response. You can retrieve the next
    -- batch of objects by requesting the list again and providing the token
    -- that was returned by the prior call in your request.
    --
    -- You can indicate the maximum number of objects that you want Shield
    -- Advanced to return for a single call with the @MaxResults@ setting.
    -- Shield Advanced will not return more than @MaxResults@ objects, but may
    -- return fewer, even if more objects are still available.
    --
    -- Whenever more objects remain that Shield Advanced has not yet returned
    -- to you, the response will include a @NextToken@ value.
    ListAttacksResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAttacksResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAttacksResponse -> ListAttacksResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAttacksResponse -> ListAttacksResponse -> Bool
$c/= :: ListAttacksResponse -> ListAttacksResponse -> Bool
== :: ListAttacksResponse -> ListAttacksResponse -> Bool
$c== :: ListAttacksResponse -> ListAttacksResponse -> Bool
Prelude.Eq, ReadPrec [ListAttacksResponse]
ReadPrec ListAttacksResponse
Int -> ReadS ListAttacksResponse
ReadS [ListAttacksResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAttacksResponse]
$creadListPrec :: ReadPrec [ListAttacksResponse]
readPrec :: ReadPrec ListAttacksResponse
$creadPrec :: ReadPrec ListAttacksResponse
readList :: ReadS [ListAttacksResponse]
$creadList :: ReadS [ListAttacksResponse]
readsPrec :: Int -> ReadS ListAttacksResponse
$creadsPrec :: Int -> ReadS ListAttacksResponse
Prelude.Read, Int -> ListAttacksResponse -> ShowS
[ListAttacksResponse] -> ShowS
ListAttacksResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAttacksResponse] -> ShowS
$cshowList :: [ListAttacksResponse] -> ShowS
show :: ListAttacksResponse -> String
$cshow :: ListAttacksResponse -> String
showsPrec :: Int -> ListAttacksResponse -> ShowS
$cshowsPrec :: Int -> ListAttacksResponse -> ShowS
Prelude.Show, forall x. Rep ListAttacksResponse x -> ListAttacksResponse
forall x. ListAttacksResponse -> Rep ListAttacksResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAttacksResponse x -> ListAttacksResponse
$cfrom :: forall x. ListAttacksResponse -> Rep ListAttacksResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAttacksResponse' 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:
--
-- 'attackSummaries', 'listAttacksResponse_attackSummaries' - The attack information for the specified time range.
--
-- 'nextToken', 'listAttacksResponse_nextToken' - When you request a list of objects from Shield Advanced, if the response
-- does not include all of the remaining available objects, Shield Advanced
-- includes a @NextToken@ value in the response. You can retrieve the next
-- batch of objects by requesting the list again and providing the token
-- that was returned by the prior call in your request.
--
-- You can indicate the maximum number of objects that you want Shield
-- Advanced to return for a single call with the @MaxResults@ setting.
-- Shield Advanced will not return more than @MaxResults@ objects, but may
-- return fewer, even if more objects are still available.
--
-- Whenever more objects remain that Shield Advanced has not yet returned
-- to you, the response will include a @NextToken@ value.
--
-- 'httpStatus', 'listAttacksResponse_httpStatus' - The response's http status code.
newListAttacksResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAttacksResponse
newListAttacksResponse :: Int -> ListAttacksResponse
newListAttacksResponse Int
pHttpStatus_ =
  ListAttacksResponse'
    { $sel:attackSummaries:ListAttacksResponse' :: Maybe [AttackSummary]
attackSummaries =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAttacksResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAttacksResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The attack information for the specified time range.
listAttacksResponse_attackSummaries :: Lens.Lens' ListAttacksResponse (Prelude.Maybe [AttackSummary])
listAttacksResponse_attackSummaries :: Lens' ListAttacksResponse (Maybe [AttackSummary])
listAttacksResponse_attackSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttacksResponse' {Maybe [AttackSummary]
attackSummaries :: Maybe [AttackSummary]
$sel:attackSummaries:ListAttacksResponse' :: ListAttacksResponse -> Maybe [AttackSummary]
attackSummaries} -> Maybe [AttackSummary]
attackSummaries) (\s :: ListAttacksResponse
s@ListAttacksResponse' {} Maybe [AttackSummary]
a -> ListAttacksResponse
s {$sel:attackSummaries:ListAttacksResponse' :: Maybe [AttackSummary]
attackSummaries = Maybe [AttackSummary]
a} :: ListAttacksResponse) 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

-- | When you request a list of objects from Shield Advanced, if the response
-- does not include all of the remaining available objects, Shield Advanced
-- includes a @NextToken@ value in the response. You can retrieve the next
-- batch of objects by requesting the list again and providing the token
-- that was returned by the prior call in your request.
--
-- You can indicate the maximum number of objects that you want Shield
-- Advanced to return for a single call with the @MaxResults@ setting.
-- Shield Advanced will not return more than @MaxResults@ objects, but may
-- return fewer, even if more objects are still available.
--
-- Whenever more objects remain that Shield Advanced has not yet returned
-- to you, the response will include a @NextToken@ value.
listAttacksResponse_nextToken :: Lens.Lens' ListAttacksResponse (Prelude.Maybe Prelude.Text)
listAttacksResponse_nextToken :: Lens' ListAttacksResponse (Maybe Text)
listAttacksResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttacksResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAttacksResponse' :: ListAttacksResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAttacksResponse
s@ListAttacksResponse' {} Maybe Text
a -> ListAttacksResponse
s {$sel:nextToken:ListAttacksResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAttacksResponse)

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

instance Prelude.NFData ListAttacksResponse where
  rnf :: ListAttacksResponse -> ()
rnf ListAttacksResponse' {Int
Maybe [AttackSummary]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
attackSummaries :: Maybe [AttackSummary]
$sel:httpStatus:ListAttacksResponse' :: ListAttacksResponse -> Int
$sel:nextToken:ListAttacksResponse' :: ListAttacksResponse -> Maybe Text
$sel:attackSummaries:ListAttacksResponse' :: ListAttacksResponse -> Maybe [AttackSummary]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AttackSummary]
attackSummaries
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus