{-# 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.FMS.GetProtectionStatus
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- If you created a Shield Advanced policy, returns policy-level attack
-- summary information in the event of a potential DDoS attack. Other
-- policy types are currently unsupported.
module Amazonka.FMS.GetProtectionStatus
  ( -- * Creating a Request
    GetProtectionStatus (..),
    newGetProtectionStatus,

    -- * Request Lenses
    getProtectionStatus_endTime,
    getProtectionStatus_maxResults,
    getProtectionStatus_memberAccountId,
    getProtectionStatus_nextToken,
    getProtectionStatus_startTime,
    getProtectionStatus_policyId,

    -- * Destructuring the Response
    GetProtectionStatusResponse (..),
    newGetProtectionStatusResponse,

    -- * Response Lenses
    getProtectionStatusResponse_adminAccountId,
    getProtectionStatusResponse_data,
    getProtectionStatusResponse_nextToken,
    getProtectionStatusResponse_serviceType,
    getProtectionStatusResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FMS.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetProtectionStatus' smart constructor.
data GetProtectionStatus = GetProtectionStatus'
  { -- | The end of the time period to query for the attacks. This is a
    -- @timestamp@ type. The request syntax listing indicates a @number@ type
    -- because the default used by Firewall Manager is Unix time in seconds.
    -- However, any valid @timestamp@ format is allowed.
    GetProtectionStatus -> Maybe POSIX
endTime :: Prelude.Maybe Data.POSIX,
    -- | Specifies the number of objects that you want Firewall Manager to return
    -- for this request. If you have more objects than the number that you
    -- specify for @MaxResults@, the response includes a @NextToken@ value that
    -- you can use to get another batch of objects.
    GetProtectionStatus -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Web Services account that is in scope of the policy that you
    -- want to get the details for.
    GetProtectionStatus -> Maybe Text
memberAccountId :: Prelude.Maybe Prelude.Text,
    -- | If you specify a value for @MaxResults@ and you have more objects than
    -- the number that you specify for @MaxResults@, Firewall Manager returns a
    -- @NextToken@ value in the response, which you can use to retrieve another
    -- group of objects. For the second and subsequent @GetProtectionStatus@
    -- requests, specify the value of @NextToken@ from the previous response to
    -- get information about another batch of objects.
    GetProtectionStatus -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The start of the time period to query for the attacks. This is a
    -- @timestamp@ type. The request syntax listing indicates a @number@ type
    -- because the default used by Firewall Manager is Unix time in seconds.
    -- However, any valid @timestamp@ format is allowed.
    GetProtectionStatus -> Maybe POSIX
startTime :: Prelude.Maybe Data.POSIX,
    -- | The ID of the policy for which you want to get the attack information.
    GetProtectionStatus -> Text
policyId :: Prelude.Text
  }
  deriving (GetProtectionStatus -> GetProtectionStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetProtectionStatus -> GetProtectionStatus -> Bool
$c/= :: GetProtectionStatus -> GetProtectionStatus -> Bool
== :: GetProtectionStatus -> GetProtectionStatus -> Bool
$c== :: GetProtectionStatus -> GetProtectionStatus -> Bool
Prelude.Eq, ReadPrec [GetProtectionStatus]
ReadPrec GetProtectionStatus
Int -> ReadS GetProtectionStatus
ReadS [GetProtectionStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetProtectionStatus]
$creadListPrec :: ReadPrec [GetProtectionStatus]
readPrec :: ReadPrec GetProtectionStatus
$creadPrec :: ReadPrec GetProtectionStatus
readList :: ReadS [GetProtectionStatus]
$creadList :: ReadS [GetProtectionStatus]
readsPrec :: Int -> ReadS GetProtectionStatus
$creadsPrec :: Int -> ReadS GetProtectionStatus
Prelude.Read, Int -> GetProtectionStatus -> ShowS
[GetProtectionStatus] -> ShowS
GetProtectionStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetProtectionStatus] -> ShowS
$cshowList :: [GetProtectionStatus] -> ShowS
show :: GetProtectionStatus -> String
$cshow :: GetProtectionStatus -> String
showsPrec :: Int -> GetProtectionStatus -> ShowS
$cshowsPrec :: Int -> GetProtectionStatus -> ShowS
Prelude.Show, forall x. Rep GetProtectionStatus x -> GetProtectionStatus
forall x. GetProtectionStatus -> Rep GetProtectionStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetProtectionStatus x -> GetProtectionStatus
$cfrom :: forall x. GetProtectionStatus -> Rep GetProtectionStatus x
Prelude.Generic)

-- |
-- Create a value of 'GetProtectionStatus' 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', 'getProtectionStatus_endTime' - The end of the time period to query for the attacks. This is a
-- @timestamp@ type. The request syntax listing indicates a @number@ type
-- because the default used by Firewall Manager is Unix time in seconds.
-- However, any valid @timestamp@ format is allowed.
--
-- 'maxResults', 'getProtectionStatus_maxResults' - Specifies the number of objects that you want Firewall Manager to return
-- for this request. If you have more objects than the number that you
-- specify for @MaxResults@, the response includes a @NextToken@ value that
-- you can use to get another batch of objects.
--
-- 'memberAccountId', 'getProtectionStatus_memberAccountId' - The Amazon Web Services account that is in scope of the policy that you
-- want to get the details for.
--
-- 'nextToken', 'getProtectionStatus_nextToken' - If you specify a value for @MaxResults@ and you have more objects than
-- the number that you specify for @MaxResults@, Firewall Manager returns a
-- @NextToken@ value in the response, which you can use to retrieve another
-- group of objects. For the second and subsequent @GetProtectionStatus@
-- requests, specify the value of @NextToken@ from the previous response to
-- get information about another batch of objects.
--
-- 'startTime', 'getProtectionStatus_startTime' - The start of the time period to query for the attacks. This is a
-- @timestamp@ type. The request syntax listing indicates a @number@ type
-- because the default used by Firewall Manager is Unix time in seconds.
-- However, any valid @timestamp@ format is allowed.
--
-- 'policyId', 'getProtectionStatus_policyId' - The ID of the policy for which you want to get the attack information.
newGetProtectionStatus ::
  -- | 'policyId'
  Prelude.Text ->
  GetProtectionStatus
newGetProtectionStatus :: Text -> GetProtectionStatus
newGetProtectionStatus Text
pPolicyId_ =
  GetProtectionStatus'
    { $sel:endTime:GetProtectionStatus' :: Maybe POSIX
endTime = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetProtectionStatus' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:memberAccountId:GetProtectionStatus' :: Maybe Text
memberAccountId = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetProtectionStatus' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:GetProtectionStatus' :: Maybe POSIX
startTime = forall a. Maybe a
Prelude.Nothing,
      $sel:policyId:GetProtectionStatus' :: Text
policyId = Text
pPolicyId_
    }

-- | The end of the time period to query for the attacks. This is a
-- @timestamp@ type. The request syntax listing indicates a @number@ type
-- because the default used by Firewall Manager is Unix time in seconds.
-- However, any valid @timestamp@ format is allowed.
getProtectionStatus_endTime :: Lens.Lens' GetProtectionStatus (Prelude.Maybe Prelude.UTCTime)
getProtectionStatus_endTime :: Lens' GetProtectionStatus (Maybe UTCTime)
getProtectionStatus_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProtectionStatus' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:GetProtectionStatus' :: GetProtectionStatus -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: GetProtectionStatus
s@GetProtectionStatus' {} Maybe POSIX
a -> GetProtectionStatus
s {$sel:endTime:GetProtectionStatus' :: Maybe POSIX
endTime = Maybe POSIX
a} :: GetProtectionStatus) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Specifies the number of objects that you want Firewall Manager to return
-- for this request. If you have more objects than the number that you
-- specify for @MaxResults@, the response includes a @NextToken@ value that
-- you can use to get another batch of objects.
getProtectionStatus_maxResults :: Lens.Lens' GetProtectionStatus (Prelude.Maybe Prelude.Natural)
getProtectionStatus_maxResults :: Lens' GetProtectionStatus (Maybe Natural)
getProtectionStatus_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProtectionStatus' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetProtectionStatus' :: GetProtectionStatus -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetProtectionStatus
s@GetProtectionStatus' {} Maybe Natural
a -> GetProtectionStatus
s {$sel:maxResults:GetProtectionStatus' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetProtectionStatus)

-- | The Amazon Web Services account that is in scope of the policy that you
-- want to get the details for.
getProtectionStatus_memberAccountId :: Lens.Lens' GetProtectionStatus (Prelude.Maybe Prelude.Text)
getProtectionStatus_memberAccountId :: Lens' GetProtectionStatus (Maybe Text)
getProtectionStatus_memberAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProtectionStatus' {Maybe Text
memberAccountId :: Maybe Text
$sel:memberAccountId:GetProtectionStatus' :: GetProtectionStatus -> Maybe Text
memberAccountId} -> Maybe Text
memberAccountId) (\s :: GetProtectionStatus
s@GetProtectionStatus' {} Maybe Text
a -> GetProtectionStatus
s {$sel:memberAccountId:GetProtectionStatus' :: Maybe Text
memberAccountId = Maybe Text
a} :: GetProtectionStatus)

-- | If you specify a value for @MaxResults@ and you have more objects than
-- the number that you specify for @MaxResults@, Firewall Manager returns a
-- @NextToken@ value in the response, which you can use to retrieve another
-- group of objects. For the second and subsequent @GetProtectionStatus@
-- requests, specify the value of @NextToken@ from the previous response to
-- get information about another batch of objects.
getProtectionStatus_nextToken :: Lens.Lens' GetProtectionStatus (Prelude.Maybe Prelude.Text)
getProtectionStatus_nextToken :: Lens' GetProtectionStatus (Maybe Text)
getProtectionStatus_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProtectionStatus' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetProtectionStatus' :: GetProtectionStatus -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetProtectionStatus
s@GetProtectionStatus' {} Maybe Text
a -> GetProtectionStatus
s {$sel:nextToken:GetProtectionStatus' :: Maybe Text
nextToken = Maybe Text
a} :: GetProtectionStatus)

-- | The start of the time period to query for the attacks. This is a
-- @timestamp@ type. The request syntax listing indicates a @number@ type
-- because the default used by Firewall Manager is Unix time in seconds.
-- However, any valid @timestamp@ format is allowed.
getProtectionStatus_startTime :: Lens.Lens' GetProtectionStatus (Prelude.Maybe Prelude.UTCTime)
getProtectionStatus_startTime :: Lens' GetProtectionStatus (Maybe UTCTime)
getProtectionStatus_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProtectionStatus' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:GetProtectionStatus' :: GetProtectionStatus -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: GetProtectionStatus
s@GetProtectionStatus' {} Maybe POSIX
a -> GetProtectionStatus
s {$sel:startTime:GetProtectionStatus' :: Maybe POSIX
startTime = Maybe POSIX
a} :: GetProtectionStatus) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The ID of the policy for which you want to get the attack information.
getProtectionStatus_policyId :: Lens.Lens' GetProtectionStatus Prelude.Text
getProtectionStatus_policyId :: Lens' GetProtectionStatus Text
getProtectionStatus_policyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProtectionStatus' {Text
policyId :: Text
$sel:policyId:GetProtectionStatus' :: GetProtectionStatus -> Text
policyId} -> Text
policyId) (\s :: GetProtectionStatus
s@GetProtectionStatus' {} Text
a -> GetProtectionStatus
s {$sel:policyId:GetProtectionStatus' :: Text
policyId = Text
a} :: GetProtectionStatus)

instance Core.AWSRequest GetProtectionStatus where
  type
    AWSResponse GetProtectionStatus =
      GetProtectionStatusResponse
  request :: (Service -> Service)
-> GetProtectionStatus -> Request GetProtectionStatus
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 GetProtectionStatus
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetProtectionStatus)))
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 Text
-> Maybe Text
-> Maybe Text
-> Maybe SecurityServiceType
-> Int
-> GetProtectionStatusResponse
GetProtectionStatusResponse'
            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
"AdminAccountId")
            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
"Data")
            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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ServiceType")
            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 GetProtectionStatus where
  hashWithSalt :: Int -> GetProtectionStatus -> Int
hashWithSalt Int
_salt GetProtectionStatus' {Maybe Natural
Maybe Text
Maybe POSIX
Text
policyId :: Text
startTime :: Maybe POSIX
nextToken :: Maybe Text
memberAccountId :: Maybe Text
maxResults :: Maybe Natural
endTime :: Maybe POSIX
$sel:policyId:GetProtectionStatus' :: GetProtectionStatus -> Text
$sel:startTime:GetProtectionStatus' :: GetProtectionStatus -> Maybe POSIX
$sel:nextToken:GetProtectionStatus' :: GetProtectionStatus -> Maybe Text
$sel:memberAccountId:GetProtectionStatus' :: GetProtectionStatus -> Maybe Text
$sel:maxResults:GetProtectionStatus' :: GetProtectionStatus -> Maybe Natural
$sel:endTime:GetProtectionStatus' :: GetProtectionStatus -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
memberAccountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
policyId

instance Prelude.NFData GetProtectionStatus where
  rnf :: GetProtectionStatus -> ()
rnf GetProtectionStatus' {Maybe Natural
Maybe Text
Maybe POSIX
Text
policyId :: Text
startTime :: Maybe POSIX
nextToken :: Maybe Text
memberAccountId :: Maybe Text
maxResults :: Maybe Natural
endTime :: Maybe POSIX
$sel:policyId:GetProtectionStatus' :: GetProtectionStatus -> Text
$sel:startTime:GetProtectionStatus' :: GetProtectionStatus -> Maybe POSIX
$sel:nextToken:GetProtectionStatus' :: GetProtectionStatus -> Maybe Text
$sel:memberAccountId:GetProtectionStatus' :: GetProtectionStatus -> Maybe Text
$sel:maxResults:GetProtectionStatus' :: GetProtectionStatus -> Maybe Natural
$sel:endTime:GetProtectionStatus' :: GetProtectionStatus -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
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
memberAccountId
      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 POSIX
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
policyId

instance Data.ToHeaders GetProtectionStatus where
  toHeaders :: GetProtectionStatus -> 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
"AWSFMS_20180101.GetProtectionStatus" ::
                          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 GetProtectionStatus where
  toJSON :: GetProtectionStatus -> Value
toJSON GetProtectionStatus' {Maybe Natural
Maybe Text
Maybe POSIX
Text
policyId :: Text
startTime :: Maybe POSIX
nextToken :: Maybe Text
memberAccountId :: Maybe Text
maxResults :: Maybe Natural
endTime :: Maybe POSIX
$sel:policyId:GetProtectionStatus' :: GetProtectionStatus -> Text
$sel:startTime:GetProtectionStatus' :: GetProtectionStatus -> Maybe POSIX
$sel:nextToken:GetProtectionStatus' :: GetProtectionStatus -> Maybe Text
$sel:memberAccountId:GetProtectionStatus' :: GetProtectionStatus -> Maybe Text
$sel:maxResults:GetProtectionStatus' :: GetProtectionStatus -> Maybe Natural
$sel:endTime:GetProtectionStatus' :: GetProtectionStatus -> Maybe POSIX
..} =
    [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 POSIX
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
"MemberAccountId" 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
memberAccountId,
            (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
"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 POSIX
startTime,
            forall a. a -> Maybe a
Prelude.Just (Key
"PolicyId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
policyId)
          ]
      )

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

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

-- | /See:/ 'newGetProtectionStatusResponse' smart constructor.
data GetProtectionStatusResponse = GetProtectionStatusResponse'
  { -- | The ID of the Firewall Manager administrator account for this policy.
    GetProtectionStatusResponse -> Maybe Text
adminAccountId :: Prelude.Maybe Prelude.Text,
    -- | Details about the attack, including the following:
    --
    -- -   Attack type
    --
    -- -   Account ID
    --
    -- -   ARN of the resource attacked
    --
    -- -   Start time of the attack
    --
    -- -   End time of the attack (ongoing attacks will not have an end time)
    --
    -- The details are in JSON format.
    GetProtectionStatusResponse -> Maybe Text
data' :: Prelude.Maybe Prelude.Text,
    -- | If you have more objects than the number that you specified for
    -- @MaxResults@ in the request, the response includes a @NextToken@ value.
    -- To list more objects, submit another @GetProtectionStatus@ request, and
    -- specify the @NextToken@ value from the response in the @NextToken@ value
    -- in the next request.
    --
    -- Amazon Web Services SDKs provide auto-pagination that identify
    -- @NextToken@ in a response and make subsequent request calls
    -- automatically on your behalf. However, this feature is not supported by
    -- @GetProtectionStatus@. You must submit subsequent requests with
    -- @NextToken@ using your own processes.
    GetProtectionStatusResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The service type that is protected by the policy. Currently, this is
    -- always @SHIELD_ADVANCED@.
    GetProtectionStatusResponse -> Maybe SecurityServiceType
serviceType :: Prelude.Maybe SecurityServiceType,
    -- | The response's http status code.
    GetProtectionStatusResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetProtectionStatusResponse -> GetProtectionStatusResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetProtectionStatusResponse -> GetProtectionStatusResponse -> Bool
$c/= :: GetProtectionStatusResponse -> GetProtectionStatusResponse -> Bool
== :: GetProtectionStatusResponse -> GetProtectionStatusResponse -> Bool
$c== :: GetProtectionStatusResponse -> GetProtectionStatusResponse -> Bool
Prelude.Eq, ReadPrec [GetProtectionStatusResponse]
ReadPrec GetProtectionStatusResponse
Int -> ReadS GetProtectionStatusResponse
ReadS [GetProtectionStatusResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetProtectionStatusResponse]
$creadListPrec :: ReadPrec [GetProtectionStatusResponse]
readPrec :: ReadPrec GetProtectionStatusResponse
$creadPrec :: ReadPrec GetProtectionStatusResponse
readList :: ReadS [GetProtectionStatusResponse]
$creadList :: ReadS [GetProtectionStatusResponse]
readsPrec :: Int -> ReadS GetProtectionStatusResponse
$creadsPrec :: Int -> ReadS GetProtectionStatusResponse
Prelude.Read, Int -> GetProtectionStatusResponse -> ShowS
[GetProtectionStatusResponse] -> ShowS
GetProtectionStatusResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetProtectionStatusResponse] -> ShowS
$cshowList :: [GetProtectionStatusResponse] -> ShowS
show :: GetProtectionStatusResponse -> String
$cshow :: GetProtectionStatusResponse -> String
showsPrec :: Int -> GetProtectionStatusResponse -> ShowS
$cshowsPrec :: Int -> GetProtectionStatusResponse -> ShowS
Prelude.Show, forall x.
Rep GetProtectionStatusResponse x -> GetProtectionStatusResponse
forall x.
GetProtectionStatusResponse -> Rep GetProtectionStatusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetProtectionStatusResponse x -> GetProtectionStatusResponse
$cfrom :: forall x.
GetProtectionStatusResponse -> Rep GetProtectionStatusResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetProtectionStatusResponse' 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:
--
-- 'adminAccountId', 'getProtectionStatusResponse_adminAccountId' - The ID of the Firewall Manager administrator account for this policy.
--
-- 'data'', 'getProtectionStatusResponse_data' - Details about the attack, including the following:
--
-- -   Attack type
--
-- -   Account ID
--
-- -   ARN of the resource attacked
--
-- -   Start time of the attack
--
-- -   End time of the attack (ongoing attacks will not have an end time)
--
-- The details are in JSON format.
--
-- 'nextToken', 'getProtectionStatusResponse_nextToken' - If you have more objects than the number that you specified for
-- @MaxResults@ in the request, the response includes a @NextToken@ value.
-- To list more objects, submit another @GetProtectionStatus@ request, and
-- specify the @NextToken@ value from the response in the @NextToken@ value
-- in the next request.
--
-- Amazon Web Services SDKs provide auto-pagination that identify
-- @NextToken@ in a response and make subsequent request calls
-- automatically on your behalf. However, this feature is not supported by
-- @GetProtectionStatus@. You must submit subsequent requests with
-- @NextToken@ using your own processes.
--
-- 'serviceType', 'getProtectionStatusResponse_serviceType' - The service type that is protected by the policy. Currently, this is
-- always @SHIELD_ADVANCED@.
--
-- 'httpStatus', 'getProtectionStatusResponse_httpStatus' - The response's http status code.
newGetProtectionStatusResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetProtectionStatusResponse
newGetProtectionStatusResponse :: Int -> GetProtectionStatusResponse
newGetProtectionStatusResponse Int
pHttpStatus_ =
  GetProtectionStatusResponse'
    { $sel:adminAccountId:GetProtectionStatusResponse' :: Maybe Text
adminAccountId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:data':GetProtectionStatusResponse' :: Maybe Text
data' = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetProtectionStatusResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceType:GetProtectionStatusResponse' :: Maybe SecurityServiceType
serviceType = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetProtectionStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ID of the Firewall Manager administrator account for this policy.
getProtectionStatusResponse_adminAccountId :: Lens.Lens' GetProtectionStatusResponse (Prelude.Maybe Prelude.Text)
getProtectionStatusResponse_adminAccountId :: Lens' GetProtectionStatusResponse (Maybe Text)
getProtectionStatusResponse_adminAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProtectionStatusResponse' {Maybe Text
adminAccountId :: Maybe Text
$sel:adminAccountId:GetProtectionStatusResponse' :: GetProtectionStatusResponse -> Maybe Text
adminAccountId} -> Maybe Text
adminAccountId) (\s :: GetProtectionStatusResponse
s@GetProtectionStatusResponse' {} Maybe Text
a -> GetProtectionStatusResponse
s {$sel:adminAccountId:GetProtectionStatusResponse' :: Maybe Text
adminAccountId = Maybe Text
a} :: GetProtectionStatusResponse)

-- | Details about the attack, including the following:
--
-- -   Attack type
--
-- -   Account ID
--
-- -   ARN of the resource attacked
--
-- -   Start time of the attack
--
-- -   End time of the attack (ongoing attacks will not have an end time)
--
-- The details are in JSON format.
getProtectionStatusResponse_data :: Lens.Lens' GetProtectionStatusResponse (Prelude.Maybe Prelude.Text)
getProtectionStatusResponse_data :: Lens' GetProtectionStatusResponse (Maybe Text)
getProtectionStatusResponse_data = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProtectionStatusResponse' {Maybe Text
data' :: Maybe Text
$sel:data':GetProtectionStatusResponse' :: GetProtectionStatusResponse -> Maybe Text
data'} -> Maybe Text
data') (\s :: GetProtectionStatusResponse
s@GetProtectionStatusResponse' {} Maybe Text
a -> GetProtectionStatusResponse
s {$sel:data':GetProtectionStatusResponse' :: Maybe Text
data' = Maybe Text
a} :: GetProtectionStatusResponse)

-- | If you have more objects than the number that you specified for
-- @MaxResults@ in the request, the response includes a @NextToken@ value.
-- To list more objects, submit another @GetProtectionStatus@ request, and
-- specify the @NextToken@ value from the response in the @NextToken@ value
-- in the next request.
--
-- Amazon Web Services SDKs provide auto-pagination that identify
-- @NextToken@ in a response and make subsequent request calls
-- automatically on your behalf. However, this feature is not supported by
-- @GetProtectionStatus@. You must submit subsequent requests with
-- @NextToken@ using your own processes.
getProtectionStatusResponse_nextToken :: Lens.Lens' GetProtectionStatusResponse (Prelude.Maybe Prelude.Text)
getProtectionStatusResponse_nextToken :: Lens' GetProtectionStatusResponse (Maybe Text)
getProtectionStatusResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProtectionStatusResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetProtectionStatusResponse' :: GetProtectionStatusResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetProtectionStatusResponse
s@GetProtectionStatusResponse' {} Maybe Text
a -> GetProtectionStatusResponse
s {$sel:nextToken:GetProtectionStatusResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetProtectionStatusResponse)

-- | The service type that is protected by the policy. Currently, this is
-- always @SHIELD_ADVANCED@.
getProtectionStatusResponse_serviceType :: Lens.Lens' GetProtectionStatusResponse (Prelude.Maybe SecurityServiceType)
getProtectionStatusResponse_serviceType :: Lens' GetProtectionStatusResponse (Maybe SecurityServiceType)
getProtectionStatusResponse_serviceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProtectionStatusResponse' {Maybe SecurityServiceType
serviceType :: Maybe SecurityServiceType
$sel:serviceType:GetProtectionStatusResponse' :: GetProtectionStatusResponse -> Maybe SecurityServiceType
serviceType} -> Maybe SecurityServiceType
serviceType) (\s :: GetProtectionStatusResponse
s@GetProtectionStatusResponse' {} Maybe SecurityServiceType
a -> GetProtectionStatusResponse
s {$sel:serviceType:GetProtectionStatusResponse' :: Maybe SecurityServiceType
serviceType = Maybe SecurityServiceType
a} :: GetProtectionStatusResponse)

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

instance Prelude.NFData GetProtectionStatusResponse where
  rnf :: GetProtectionStatusResponse -> ()
rnf GetProtectionStatusResponse' {Int
Maybe Text
Maybe SecurityServiceType
httpStatus :: Int
serviceType :: Maybe SecurityServiceType
nextToken :: Maybe Text
data' :: Maybe Text
adminAccountId :: Maybe Text
$sel:httpStatus:GetProtectionStatusResponse' :: GetProtectionStatusResponse -> Int
$sel:serviceType:GetProtectionStatusResponse' :: GetProtectionStatusResponse -> Maybe SecurityServiceType
$sel:nextToken:GetProtectionStatusResponse' :: GetProtectionStatusResponse -> Maybe Text
$sel:data':GetProtectionStatusResponse' :: GetProtectionStatusResponse -> Maybe Text
$sel:adminAccountId:GetProtectionStatusResponse' :: GetProtectionStatusResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
adminAccountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
data'
      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 SecurityServiceType
serviceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus