{-# 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-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)
--
-- 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_memberAccountId,
    getProtectionStatus_startTime,
    getProtectionStatus_nextToken,
    getProtectionStatus_endTime,
    getProtectionStatus_maxResults,
    getProtectionStatus_policyId,

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

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

import qualified Amazonka.Core as Core
import Amazonka.FMS.Types
import qualified Amazonka.Lens as Lens
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 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,
    -- | 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 Core.POSIX,
    -- | 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 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 Core.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 ID of the policy for which you want to get the attack information.
    GetProtectionStatus -> Text
policyId :: Prelude.Text
  }
  deriving (GetProtectionStatus -> GetProtectionStatus -> Bool
(GetProtectionStatus -> GetProtectionStatus -> Bool)
-> (GetProtectionStatus -> GetProtectionStatus -> Bool)
-> Eq GetProtectionStatus
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]
(Int -> ReadS GetProtectionStatus)
-> ReadS [GetProtectionStatus]
-> ReadPrec GetProtectionStatus
-> ReadPrec [GetProtectionStatus]
-> Read 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
(Int -> GetProtectionStatus -> ShowS)
-> (GetProtectionStatus -> String)
-> ([GetProtectionStatus] -> ShowS)
-> Show GetProtectionStatus
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. GetProtectionStatus -> Rep GetProtectionStatus x)
-> (forall x. Rep GetProtectionStatus x -> GetProtectionStatus)
-> Generic GetProtectionStatus
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:
--
-- 'memberAccountId', 'getProtectionStatus_memberAccountId' - The Amazon Web Services account that is in scope of the policy that you
-- want to get the details for.
--
-- '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.
--
-- '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.
--
-- '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.
--
-- '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' :: Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Natural
-> Text
-> GetProtectionStatus
GetProtectionStatus'
    { $sel:memberAccountId:GetProtectionStatus' :: Maybe Text
memberAccountId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:GetProtectionStatus' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetProtectionStatus' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:GetProtectionStatus' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetProtectionStatus' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:policyId:GetProtectionStatus' :: Text
policyId = Text
pPolicyId_
    }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> GetProtectionStatus -> f GetProtectionStatus
getProtectionStatus_memberAccountId = (GetProtectionStatus -> Maybe Text)
-> (GetProtectionStatus -> Maybe Text -> GetProtectionStatus)
-> Lens
     GetProtectionStatus GetProtectionStatus (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetProtectionStatus -> f GetProtectionStatus
getProtectionStatus_startTime = (GetProtectionStatus -> Maybe POSIX)
-> (GetProtectionStatus -> Maybe POSIX -> GetProtectionStatus)
-> Lens
     GetProtectionStatus GetProtectionStatus (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> GetProtectionStatus -> f GetProtectionStatus)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetProtectionStatus
-> f GetProtectionStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> GetProtectionStatus -> f GetProtectionStatus
getProtectionStatus_nextToken = (GetProtectionStatus -> Maybe Text)
-> (GetProtectionStatus -> Maybe Text -> GetProtectionStatus)
-> Lens
     GetProtectionStatus GetProtectionStatus (Maybe Text) (Maybe Text)
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 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 :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetProtectionStatus -> f GetProtectionStatus
getProtectionStatus_endTime = (GetProtectionStatus -> Maybe POSIX)
-> (GetProtectionStatus -> Maybe POSIX -> GetProtectionStatus)
-> Lens
     GetProtectionStatus GetProtectionStatus (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> GetProtectionStatus -> f GetProtectionStatus)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetProtectionStatus
-> f GetProtectionStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._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 :: (Maybe Natural -> f (Maybe Natural))
-> GetProtectionStatus -> f GetProtectionStatus
getProtectionStatus_maxResults = (GetProtectionStatus -> Maybe Natural)
-> (GetProtectionStatus -> Maybe Natural -> GetProtectionStatus)
-> Lens
     GetProtectionStatus
     GetProtectionStatus
     (Maybe Natural)
     (Maybe Natural)
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 ID of the policy for which you want to get the attack information.
getProtectionStatus_policyId :: Lens.Lens' GetProtectionStatus Prelude.Text
getProtectionStatus_policyId :: (Text -> f Text) -> GetProtectionStatus -> f GetProtectionStatus
getProtectionStatus_policyId = (GetProtectionStatus -> Text)
-> (GetProtectionStatus -> Text -> GetProtectionStatus)
-> Lens GetProtectionStatus GetProtectionStatus Text Text
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 :: GetProtectionStatus -> Request GetProtectionStatus
request = Service -> GetProtectionStatus -> Request GetProtectionStatus
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetProtectionStatus
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetProtectionStatus)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetProtectionStatus))
-> Logger
-> Service
-> Proxy GetProtectionStatus
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetProtectionStatus)))
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 Text
-> Maybe Text
-> Maybe Text
-> Maybe SecurityServiceType
-> Int
-> GetProtectionStatusResponse
GetProtectionStatusResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe SecurityServiceType
 -> Int
 -> GetProtectionStatusResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe SecurityServiceType
      -> Int
      -> GetProtectionStatusResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Data")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe SecurityServiceType
   -> Int
   -> GetProtectionStatusResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe SecurityServiceType -> Int -> GetProtectionStatusResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AdminAccountId")
            Either
  String
  (Maybe Text
   -> Maybe SecurityServiceType -> Int -> GetProtectionStatusResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe SecurityServiceType -> Int -> GetProtectionStatusResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either
  String
  (Maybe SecurityServiceType -> Int -> GetProtectionStatusResponse)
-> Either String (Maybe SecurityServiceType)
-> Either String (Int -> GetProtectionStatusResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe SecurityServiceType)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ServiceType")
            Either String (Int -> GetProtectionStatusResponse)
-> Either String Int -> Either String GetProtectionStatusResponse
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 GetProtectionStatus

instance Prelude.NFData GetProtectionStatus

instance Core.ToHeaders GetProtectionStatus where
  toHeaders :: GetProtectionStatus -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetProtectionStatus -> 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
"AWSFMS_20180101.GetProtectionStatus" ::
                          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 GetProtectionStatus where
  toJSON :: GetProtectionStatus -> Value
toJSON GetProtectionStatus' {Maybe Natural
Maybe Text
Maybe POSIX
Text
policyId :: Text
maxResults :: Maybe Natural
endTime :: Maybe POSIX
nextToken :: Maybe Text
startTime :: Maybe POSIX
memberAccountId :: Maybe Text
$sel:policyId:GetProtectionStatus' :: GetProtectionStatus -> Text
$sel:maxResults:GetProtectionStatus' :: GetProtectionStatus -> Maybe Natural
$sel:endTime:GetProtectionStatus' :: GetProtectionStatus -> Maybe POSIX
$sel:nextToken:GetProtectionStatus' :: GetProtectionStatus -> Maybe Text
$sel:startTime:GetProtectionStatus' :: GetProtectionStatus -> Maybe POSIX
$sel:memberAccountId:GetProtectionStatus' :: GetProtectionStatus -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"MemberAccountId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
memberAccountId,
            (Text
"StartTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
startTime,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"EndTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
endTime,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PolicyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
policyId)
          ]
      )

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

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

-- | /See:/ 'newGetProtectionStatusResponse' smart constructor.
data GetProtectionStatusResponse = 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 -> Maybe Text
data' :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Firewall Manager administrator account for this policy.
    GetProtectionStatusResponse -> Maybe Text
adminAccountId :: 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
(GetProtectionStatusResponse
 -> GetProtectionStatusResponse -> Bool)
-> (GetProtectionStatusResponse
    -> GetProtectionStatusResponse -> Bool)
-> Eq GetProtectionStatusResponse
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]
(Int -> ReadS GetProtectionStatusResponse)
-> ReadS [GetProtectionStatusResponse]
-> ReadPrec GetProtectionStatusResponse
-> ReadPrec [GetProtectionStatusResponse]
-> Read 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
(Int -> GetProtectionStatusResponse -> ShowS)
-> (GetProtectionStatusResponse -> String)
-> ([GetProtectionStatusResponse] -> ShowS)
-> Show GetProtectionStatusResponse
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.
 GetProtectionStatusResponse -> Rep GetProtectionStatusResponse x)
-> (forall x.
    Rep GetProtectionStatusResponse x -> GetProtectionStatusResponse)
-> Generic GetProtectionStatusResponse
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:
--
-- '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.
--
-- 'adminAccountId', 'getProtectionStatusResponse_adminAccountId' - The ID of the Firewall Manager administrator account for this policy.
--
-- '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' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe SecurityServiceType
-> Int
-> GetProtectionStatusResponse
GetProtectionStatusResponse'
    { $sel:data':GetProtectionStatusResponse' :: Maybe Text
data' =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:adminAccountId:GetProtectionStatusResponse' :: Maybe Text
adminAccountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetProtectionStatusResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceType:GetProtectionStatusResponse' :: Maybe SecurityServiceType
serviceType = Maybe SecurityServiceType
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetProtectionStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> GetProtectionStatusResponse -> f GetProtectionStatusResponse
getProtectionStatusResponse_data = (GetProtectionStatusResponse -> Maybe Text)
-> (GetProtectionStatusResponse
    -> Maybe Text -> GetProtectionStatusResponse)
-> Lens
     GetProtectionStatusResponse
     GetProtectionStatusResponse
     (Maybe Text)
     (Maybe Text)
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)

-- | The ID of the Firewall Manager administrator account for this policy.
getProtectionStatusResponse_adminAccountId :: Lens.Lens' GetProtectionStatusResponse (Prelude.Maybe Prelude.Text)
getProtectionStatusResponse_adminAccountId :: (Maybe Text -> f (Maybe Text))
-> GetProtectionStatusResponse -> f GetProtectionStatusResponse
getProtectionStatusResponse_adminAccountId = (GetProtectionStatusResponse -> Maybe Text)
-> (GetProtectionStatusResponse
    -> Maybe Text -> GetProtectionStatusResponse)
-> Lens
     GetProtectionStatusResponse
     GetProtectionStatusResponse
     (Maybe Text)
     (Maybe Text)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> GetProtectionStatusResponse -> f GetProtectionStatusResponse
getProtectionStatusResponse_nextToken = (GetProtectionStatusResponse -> Maybe Text)
-> (GetProtectionStatusResponse
    -> Maybe Text -> GetProtectionStatusResponse)
-> Lens
     GetProtectionStatusResponse
     GetProtectionStatusResponse
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe SecurityServiceType -> f (Maybe SecurityServiceType))
-> GetProtectionStatusResponse -> f GetProtectionStatusResponse
getProtectionStatusResponse_serviceType = (GetProtectionStatusResponse -> Maybe SecurityServiceType)
-> (GetProtectionStatusResponse
    -> Maybe SecurityServiceType -> GetProtectionStatusResponse)
-> Lens
     GetProtectionStatusResponse
     GetProtectionStatusResponse
     (Maybe SecurityServiceType)
     (Maybe SecurityServiceType)
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 :: (Int -> f Int)
-> GetProtectionStatusResponse -> f GetProtectionStatusResponse
getProtectionStatusResponse_httpStatus = (GetProtectionStatusResponse -> Int)
-> (GetProtectionStatusResponse
    -> Int -> GetProtectionStatusResponse)
-> Lens
     GetProtectionStatusResponse GetProtectionStatusResponse Int Int
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